vy commented on code in PR #2015:
URL: https://github.com/apache/logging-log4j2/pull/2015#discussion_r1409053728


##########
log4j-to-slf4j/src/test/java/org/apache/logging/slf4j/LogBuilderTest.java:
##########
@@ -31,31 +30,29 @@
 import org.apache.logging.log4j.Logger;
 import org.apache.logging.log4j.message.Message;
 import org.apache.logging.log4j.message.SimpleMessage;
+import org.apache.logging.log4j.test.junit.UsingStatusListener;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
-import org.slf4j.LoggerFactory;
 
+@UsingStatusListener
+@LoggerContextSource
 public class LogBuilderTest {
 
-    private static final String CONFIG = 
"target/test-classes/logback-turbofilter.xml";
     private static final CharSequence CHAR_SEQUENCE = "CharSequence";
     private static final String STRING = "String";
     private static final Message MESSAGE = new SimpleMessage();
     private static final Object[] P = {"p0", "p1", "p2", "p3", "p4", "p5", 
"p6", "p7", "p8", "p9"};
-    private static final Object OBJECT = "Object";
+    private static Object OBJECT = "Object";

Review Comment:
   This is not possible:
   ```
   java.lang.UnsupportedOperationException: java.lang.IllegalAccessException: 
Can not set static final java.lang.Object field 
org.apache.logging.slf4j.LogBuilderTest.OBJECT to 
org.apache.logging.log4j.test.junit.TestPropertySource$JUnitTestProperties
        at 
org.apache.logging.log4j.util.ReflectionUtil.setFieldValue(ReflectionUtil.java:130)
        at 
org.apache.logging.log4j.util.ReflectionUtil.setStaticFieldValue(ReflectionUtil.java:143)
        at 
org.apache.logging.log4j.test.junit.TestPropertyResolver.lambda$beforeAll$5(TestPropertyResolver.java:64)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at 
java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
        at 
org.apache.logging.log4j.test.junit.TestPropertyResolver.beforeAll(TestPropertyResolver.java:64)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
   Caused by: java.lang.IllegalAccessException: Can not set static final 
java.lang.Object field org.apache.logging.slf4j.LogBuilderTest.OBJECT to 
org.apache.logging.log4j.test.junit.TestPropertySource$JUnitTestProperties
        at java.base/java.lang.reflect.Field.set(Field.java:780)
        at 
org.apache.logging.log4j.util.ReflectionUtil.setFieldValue(ReflectionUtil.java:128)
        ... 6 more
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to