Class 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 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 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)