Class MockLogger

  • All Implemented Interfaces:
    java.io.Serializable, org.slf4j.Logger

    public class MockLogger
    extends org.slf4j.helpers.MarkerIgnoringBase

    Simple implementation of Logger based on SimpleLogger from SLF4J

    This implementation is heavily inspired by Apache Commons Logging's SimpleLog.

    Author:
    Ceki Gülcü, Scott Sanders, Rod Waldhoff, Robert Burrell Donkin, Cédrik LIME
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void debug​(java.lang.String msg)
      A simple implementation which logs messages of level DEBUG according to the format outlined above.
      void debug​(java.lang.String format, java.lang.Object param1)
      Perform single parameter substitution before logging the message of level DEBUG according to the format outlined above.
      void debug​(java.lang.String format, java.lang.Object... argArray)
      Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
      void debug​(java.lang.String format, java.lang.Object param1, java.lang.Object param2)
      Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
      void debug​(java.lang.String msg, java.lang.Throwable t)
      Log a message of level DEBUG, including an exception.
      void error​(java.lang.String msg)
      A simple implementation which always logs messages of level ERROR according to the format outlined above.
      void error​(java.lang.String format, java.lang.Object arg)
      Perform single parameter substitution before logging the message of level ERROR according to the format outlined above.
      void error​(java.lang.String format, java.lang.Object... argArray)
      Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
      void error​(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
      Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
      void error​(java.lang.String msg, java.lang.Throwable t)
      Log a message of level ERROR, including an exception.
      java.lang.String getName()  
      void info​(java.lang.String msg)
      A simple implementation which logs messages of level INFO according to the format outlined above.
      void info​(java.lang.String format, java.lang.Object arg)
      Perform single parameter substitution before logging the message of level INFO according to the format outlined above.
      void info​(java.lang.String format, java.lang.Object... argArray)
      Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
      void info​(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
      Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
      void info​(java.lang.String msg, java.lang.Throwable t)
      Log a message of level INFO, including an exception.
      boolean isDebugEnabled()
      Are debug messages currently enabled?
      boolean isErrorEnabled()
      Are error messages currently enabled?
      boolean isInfoEnabled()
      Are info messages currently enabled?
      protected boolean isLevelEnabled​(Level logLevel)
      Is the given log level currently enabled?
      boolean isTraceEnabled()
      Are trace messages currently enabled?
      boolean isWarnEnabled()
      Are warn messages currently enabled?
      protected java.lang.Object readResolve()  
      void trace​(java.lang.String msg)
      A simple implementation which logs messages of level TRACE according to the format outlined above.
      void trace​(java.lang.String format, java.lang.Object param1)
      Perform single parameter substitution before logging the message of level TRACE according to the format outlined above.
      void trace​(java.lang.String format, java.lang.Object... argArray)
      Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
      void trace​(java.lang.String format, java.lang.Object param1, java.lang.Object param2)
      Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
      void trace​(java.lang.String msg, java.lang.Throwable t)
      Log a message of level TRACE, including an exception.
      void warn​(java.lang.String msg)
      A simple implementation which always logs messages of level WARN according to the format outlined above.
      void warn​(java.lang.String format, java.lang.Object arg)
      Perform single parameter substitution before logging the message of level WARN according to the format outlined above.
      void warn​(java.lang.String format, java.lang.Object... argArray)
      Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
      void warn​(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
      Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
      void warn​(java.lang.String msg, java.lang.Throwable t)
      Log a message of level WARN, including an exception.
      • Methods inherited from class org.slf4j.helpers.MarkerIgnoringBase

        debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, toString, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.slf4j.Logger

        getName
    • Field Detail

      • SYSTEM_PREFIX

        public static final java.lang.String SYSTEM_PREFIX
        All system properties used by MockLogger start with this prefix
        See Also:
        Constant Field Values
      • DEFAULT_LOG_LEVEL_KEY

        public static final java.lang.String DEFAULT_LOG_LEVEL_KEY
        See Also:
        Constant Field Values
      • SHOW_DATE_TIME_KEY

        public static final java.lang.String SHOW_DATE_TIME_KEY
        See Also:
        Constant Field Values
      • DATE_TIME_FORMAT_KEY

        public static final java.lang.String DATE_TIME_FORMAT_KEY
        See Also:
        Constant Field Values
      • SHOW_THREAD_NAME_KEY

        public static final java.lang.String SHOW_THREAD_NAME_KEY
        See Also:
        Constant Field Values
      • SHOW_LOG_NAME_KEY

        public static final java.lang.String SHOW_LOG_NAME_KEY
        See Also:
        Constant Field Values
      • SHOW_SHORT_LOG_NAME_KEY

        public static final java.lang.String SHOW_SHORT_LOG_NAME_KEY
        See Also:
        Constant Field Values
      • LEVEL_IN_BRACKETS_KEY

        public static final java.lang.String LEVEL_IN_BRACKETS_KEY
        See Also:
        Constant Field Values
      • WARN_LEVEL_STRING_KEY

        public static final java.lang.String WARN_LEVEL_STRING_KEY
        See Also:
        Constant Field Values
      • currentLogLevel

        protected Level currentLogLevel
        The current log level
      • name

        protected java.lang.String name
    • Method Detail

      • isLevelEnabled

        protected boolean isLevelEnabled​(Level logLevel)
        Is the given log level currently enabled?
        Parameters:
        logLevel - is this level enabled?
      • isTraceEnabled

        public boolean isTraceEnabled()
        Are trace messages currently enabled?
      • trace

        public void trace​(java.lang.String msg)
        A simple implementation which logs messages of level TRACE according to the format outlined above.
      • trace

        public void trace​(java.lang.String format,
                          java.lang.Object param1)
        Perform single parameter substitution before logging the message of level TRACE according to the format outlined above.
      • trace

        public void trace​(java.lang.String format,
                          java.lang.Object param1,
                          java.lang.Object param2)
        Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
      • trace

        public void trace​(java.lang.String format,
                          java.lang.Object... argArray)
        Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
      • trace

        public void trace​(java.lang.String msg,
                          java.lang.Throwable t)
        Log a message of level TRACE, including an exception.
      • isDebugEnabled

        public boolean isDebugEnabled()
        Are debug messages currently enabled?
      • debug

        public void debug​(java.lang.String msg)
        A simple implementation which logs messages of level DEBUG according to the format outlined above.
      • debug

        public void debug​(java.lang.String format,
                          java.lang.Object param1)
        Perform single parameter substitution before logging the message of level DEBUG according to the format outlined above.
      • debug

        public void debug​(java.lang.String format,
                          java.lang.Object param1,
                          java.lang.Object param2)
        Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
      • debug

        public void debug​(java.lang.String format,
                          java.lang.Object... argArray)
        Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
      • debug

        public void debug​(java.lang.String msg,
                          java.lang.Throwable t)
        Log a message of level DEBUG, including an exception.
      • isInfoEnabled

        public boolean isInfoEnabled()
        Are info messages currently enabled?
      • info

        public void info​(java.lang.String msg)
        A simple implementation which logs messages of level INFO according to the format outlined above.
      • info

        public void info​(java.lang.String format,
                         java.lang.Object arg)
        Perform single parameter substitution before logging the message of level INFO according to the format outlined above.
      • info

        public void info​(java.lang.String format,
                         java.lang.Object arg1,
                         java.lang.Object arg2)
        Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
      • info

        public void info​(java.lang.String format,
                         java.lang.Object... argArray)
        Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
      • info

        public void info​(java.lang.String msg,
                         java.lang.Throwable t)
        Log a message of level INFO, including an exception.
      • isWarnEnabled

        public boolean isWarnEnabled()
        Are warn messages currently enabled?
      • warn

        public void warn​(java.lang.String msg)
        A simple implementation which always logs messages of level WARN according to the format outlined above.
      • warn

        public void warn​(java.lang.String format,
                         java.lang.Object arg)
        Perform single parameter substitution before logging the message of level WARN according to the format outlined above.
      • warn

        public void warn​(java.lang.String format,
                         java.lang.Object arg1,
                         java.lang.Object arg2)
        Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
      • warn

        public void warn​(java.lang.String format,
                         java.lang.Object... argArray)
        Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
      • warn

        public void warn​(java.lang.String msg,
                         java.lang.Throwable t)
        Log a message of level WARN, including an exception.
      • isErrorEnabled

        public boolean isErrorEnabled()
        Are error messages currently enabled?
      • error

        public void error​(java.lang.String msg)
        A simple implementation which always logs messages of level ERROR according to the format outlined above.
      • error

        public void error​(java.lang.String format,
                          java.lang.Object arg)
        Perform single parameter substitution before logging the message of level ERROR according to the format outlined above.
      • error

        public void error​(java.lang.String format,
                          java.lang.Object arg1,
                          java.lang.Object arg2)
        Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
      • error

        public void error​(java.lang.String format,
                          java.lang.Object... argArray)
        Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
      • error

        public void error​(java.lang.String msg,
                          java.lang.Throwable t)
        Log a message of level ERROR, including an exception.
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface org.slf4j.Logger
      • readResolve

        protected java.lang.Object readResolve()
                                        throws java.io.ObjectStreamException
        Throws:
        java.io.ObjectStreamException