Class Log4jLogger
java.lang.Object
org.junit.rules.TestWatcher
com.atlassian.bamboo.testutils.junit.rule.Log4jLogger
- All Implemented Interfaces:
org.junit.rules.TestRule
public class Log4jLogger
extends org.junit.rules.TestWatcher
Watches log4j logs. This can be used to spy on log4j or slf4j when testing.
- Since:
- 9.5
-
Constructor Summary
ConstructorDescriptionCreates a watcher of the root categoryLog4jLogger
(Class<?> clazz) Creates a watcher of the given class categoryLog4jLogger
(String category) Creates a watcher of the given category -
Method Summary
Methods inherited from class org.junit.rules.TestWatcher
apply, failed, skipped, skipped, succeeded
-
Constructor Details
-
Log4jLogger
Creates a watcher of the given category- Parameters:
category
- the category to watch
-
Log4jLogger
public Log4jLogger()Creates a watcher of the root category -
Log4jLogger
Creates a watcher of the given class category- Parameters:
clazz
- the class category to watch
-
-
Method Details
-
starting
protected void starting(org.junit.runner.Description description) - Overrides:
starting
in classorg.junit.rules.TestWatcher
-
finished
protected void finished(org.junit.runner.Description description) - Overrides:
finished
in classorg.junit.rules.TestWatcher
-
getMessage
-
reset
public void reset() -
setLevel
public void setLevel(org.apache.logging.log4j.Level level) -
setLevel
public void setLevel(org.apache.log4j.Level level)
-