Class LoggingListener
java.lang.Object
org.junit.runner.notification.RunListener
org.elasticsearch.test.junit.listeners.LoggingListener
public class LoggingListener
extends org.junit.runner.notification.RunListener
A
RunListener
that allows changing the log level for a specific test method. When a test method is annotated with the
TestLogging
annotation, the level for the specified loggers will be internally saved before the test method execution and
overridden with the specified ones. At the end of the test method execution the original loggers levels will be restored.
This class is not thread-safe. Given the static nature of the logging API, it assumes that tests are never run concurrently in the same
JVM. For the very same reason no synchronization has been implemented regarding the save/restore process of the original loggers
levels.-
Nested Class Summary
Nested classes/interfaces inherited from class org.junit.runner.notification.RunListener
org.junit.runner.notification.RunListener.ThreadSafe
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
testFinished
(org.junit.runner.Description description) void
testRunFinished
(org.junit.runner.Result result) void
testRunStarted
(org.junit.runner.Description description) void
testStarted
(org.junit.runner.Description description) Methods inherited from class org.junit.runner.notification.RunListener
testAssumptionFailure, testFailure, testIgnored, testSuiteFinished, testSuiteStarted
-
Constructor Details
-
LoggingListener
public LoggingListener()
-
-
Method Details
-
testRunStarted
- Overrides:
testRunStarted
in classorg.junit.runner.notification.RunListener
- Throws:
Exception
-
testRunFinished
- Overrides:
testRunFinished
in classorg.junit.runner.notification.RunListener
- Throws:
Exception
-
testStarted
- Overrides:
testStarted
in classorg.junit.runner.notification.RunListener
- Throws:
Exception
-
testFinished
- Overrides:
testFinished
in classorg.junit.runner.notification.RunListener
- Throws:
Exception
-