24
24
import org .apache .logging .log4j .core .LoggerContext ;
25
25
import org .apache .logging .log4j .core .test .appender .ListAppender ;
26
26
import org .apache .logging .log4j .core .test .junit .LoggerContextSource ;
27
- import org .apache .logging .log4j .test .junit .UsingStatusListener ;
28
27
import org .apache .logging .log4j .util .Strings ;
29
28
import org .junit .jupiter .api .Test ;
30
29
31
- @ UsingStatusListener
32
30
class LoggerTest {
33
31
34
32
@ Test
@@ -39,20 +37,20 @@ void testFactory() {
39
37
40
38
@ Test
41
39
@ LoggerContextSource ("LoggerTest.xml" )
42
- void testLog (final LoggerContext loggerContext ) {
40
+ void testLog (final LoggerContext context ) {
43
41
final Log logger = LogFactory .getLog ("LoggerTest" );
44
42
logger .debug ("Test message" );
45
- verify (loggerContext , "o.a.l.l.j.LoggerTest Test message MDC{}" + Strings .LINE_SEPARATOR );
43
+ verify (context , "o.a.l.l.j.LoggerTest Test message MDC{}" + Strings .LINE_SEPARATOR );
46
44
logger .debug ("Exception: " , new NullPointerException ("Test" ));
47
- verify (loggerContext , "o.a.l.l.j.LoggerTest Exception: MDC{}" + Strings .LINE_SEPARATOR );
45
+ verify (context , "o.a.l.l.j.LoggerTest Exception: MDC{}" + Strings .LINE_SEPARATOR );
48
46
logger .info ("Info Message" );
49
- verify (loggerContext , "o.a.l.l.j.LoggerTest Info Message MDC{}" + Strings .LINE_SEPARATOR );
47
+ verify (context , "o.a.l.l.j.LoggerTest Info Message MDC{}" + Strings .LINE_SEPARATOR );
50
48
logger .info ("Info Message {}" );
51
- verify (loggerContext , "o.a.l.l.j.LoggerTest Info Message {} MDC{}" + Strings .LINE_SEPARATOR );
49
+ verify (context , "o.a.l.l.j.LoggerTest Info Message {} MDC{}" + Strings .LINE_SEPARATOR );
52
50
}
53
51
54
- private static void verify (final LoggerContext loggerContext , final String expected ) {
55
- final ListAppender listApp = loggerContext .getConfiguration ().getAppender ("List" );
52
+ private static void verify (final LoggerContext context , final String expected ) {
53
+ final ListAppender listApp = context .getConfiguration ().getAppender ("List" );
56
54
final List <String > events = listApp .getMessages ();
57
55
assertThat (events ).hasSize (1 ).containsExactly (expected );
58
56
listApp .clear ();
0 commit comments