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:

    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
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      String value
      The name of the logger.
    • Element Detail

      • value

        String value
        The name of the logger.