Annotation Type TestLogger
-
@ExtendWith(com.github.robtimus.junit.support.extension.testlogger.TestLoggerExtension.class) @Target({FIELD,PARAMETER,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface TestLogger
TestLoggercan be used to annotate a field or a parameter in a lifecycle method or test method that should be resolved into a logging context. This logging context can be used to easily set log levels and add or replace appenders.The following logging contexts are supported:
Reload4jLoggerContextfor reload4j loggersLogbackLoggerContextfor logback loggersLog4jLoggerContextfor Log4j 2 loggersJdkLoggerContextforLoggerinstances
Logger contexts will restore the original settings once they go out of scope. For logger contexts injected in instance fields or method parameter, that will occur as soon as a test method ends. For logger contexts injected in static fields or constructor parameters, that may not occur as often. If needed, the
restoremethod of a logger context can be used to explicitly restore the original settings.- Author:
- Rob Spoor
- Since:
- 2.1
-
-
Element Detail
-
value
String value
The name of the logger.
-
-