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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidtestFinished(org.junit.runner.Description description) voidtestRunFinished(org.junit.runner.Result result) voidtestRunStarted(org.junit.runner.Description description) voidtestStarted(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:
testRunStartedin classorg.junit.runner.notification.RunListener- Throws:
Exception
-
testRunFinished
- Overrides:
testRunFinishedin classorg.junit.runner.notification.RunListener- Throws:
Exception
-
testStarted
- Overrides:
testStartedin classorg.junit.runner.notification.RunListener- Throws:
Exception
-
testFinished
- Overrides:
testFinishedin classorg.junit.runner.notification.RunListener- Throws:
Exception
-