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
Constructors Constructor Description Log4jLogger()
Creates 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
finished(org.junit.runner.Description description)
String
getMessage()
void
reset()
void
setLevel(org.apache.log4j.Level level)
void
setLevel(org.apache.logging.log4j.Level level)
protected void
starting(org.junit.runner.Description description)
-
-
-
Constructor Detail
-
Log4jLogger
public Log4jLogger(String category)
Creates a watcher of the given category- Parameters:
category
- the category to watch
-
Log4jLogger
public Log4jLogger()
Creates a watcher of the root category
-
Log4jLogger
public Log4jLogger(Class<?> clazz)
Creates a watcher of the given class category- Parameters:
clazz
- the class category to watch
-
-
Method Detail
-
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
public String getMessage()
-
reset
public void reset()
-
setLevel
public void setLevel(org.apache.logging.log4j.Level level)
-
setLevel
public void setLevel(org.apache.log4j.Level level)
-
-