Class Log4J2Logger
java.lang.Object
com.atlassian.confluence.test.util.AnnotatedMethodTemplate<Log4J2Logger.Record>
com.atlassian.confluence.test.util.Log4J2Logger
- All Implemented Interfaces:
 org.junit.rules.TestRule
Record the logging output for a given log4j2 logger.
 
Usage:
 public class MyTest
   {
      @literal @Rule public Log4J2Logger logger = new Log4JLogger(MyTest.class);
      @literal @Test
      @literal @Log4J2Logger.Record(loggerClass = MyUnitUnderTest.class, logLevel = Log4J2Logger.LogLevel.INFO)
       public void myTestMethod() throws Exception
       {
           // call unit under test
           Assert.assertEquals("expected log message", logger.snapshot());
       }
  }
  
 - Since:
 - 7.20
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic @interface - 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.logging.log4j.core.StringLayoutFields inherited from class com.atlassian.confluence.test.util.AnnotatedMethodTemplate
annotationClass, testClass - 
Constructor Summary
ConstructorsConstructorDescriptionLog4J2Logger(Class testClass) Log4J2Logger(Class testClass, org.apache.logging.log4j.core.StringLayout layout)  - 
Method Summary
Modifier and TypeMethodDescriptionprotected org.junit.runners.model.StatementapplyForAnnotation(org.junit.runners.model.Statement statement, org.junit.runner.Description description, Log4J2Logger.Record record) snapshot()Methods inherited from class com.atlassian.confluence.test.util.AnnotatedMethodTemplate
apply 
- 
Field Details
- 
layout
protected final org.apache.logging.log4j.core.StringLayout layout 
 - 
 - 
Constructor Details
- 
Log4J2Logger
 - 
Log4J2Logger
 
 - 
 - 
Method Details
- 
applyForAnnotation
protected org.junit.runners.model.Statement applyForAnnotation(org.junit.runners.model.Statement statement, org.junit.runner.Description description, Log4J2Logger.Record record) - Specified by:
 applyForAnnotationin classAnnotatedMethodTemplate<Log4J2Logger.Record>
 - 
snapshot
 
 -