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
    Creates a watcher of the root category
    Log4jLogger(Class<?> clazz)
    Creates a watcher of the given class category
    Log4jLogger(String category)
    Creates a watcher of the given category
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    finished(org.junit.runner.Description description)
     
     
    void
     
    void
    setLevel(org.apache.log4j.Level level)
     
    void
    setLevel(org.apache.logging.log4j.Level level)
     
    protected void
    starting(org.junit.runner.Description description)
     

    Methods inherited from class org.junit.rules.TestWatcher

    apply, failed, skipped, skipped, succeeded

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • 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 Details

    • starting

      protected void starting(org.junit.runner.Description description)
      Overrides:
      starting in class org.junit.rules.TestWatcher
    • finished

      protected void finished(org.junit.runner.Description description)
      Overrides:
      finished in class org.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)