Annotation Type TestLogger
-
@ExtendWith(com.github.robtimus.junit.support.extension.testlogger.TestLoggerExtension.class) @Target({FIELD,PARAMETER,ANNOTATION_TYPE}) @Retention(RUNTIME) public @interface TestLogger
TestLogger
can 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:
Reload4jLoggerContext
for reload4j loggersLogbackLoggerContext
for logback loggersLog4jLoggerContext
for Log4j 2 loggersJdkLoggerContext
forLogger
instances
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
restore
method 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.
-
-