Package org.opennms.core.test
Class MockLogger
- java.lang.Object
-
- org.slf4j.helpers.MarkerIgnoringBase
-
- org.opennms.core.test.MockLogger
-
- All Implemented Interfaces:
Serializable,org.slf4j.Logger
public class MockLogger extends org.slf4j.helpers.MarkerIgnoringBaseSimple implementation of
Loggerbased on SimpleLogger from SLF4JThis 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
-
-
Field Summary
Fields Modifier and Type Field Description protected LevelcurrentLogLevelThe current log levelstatic StringDATE_TIME_FORMAT_KEYstatic StringDEFAULT_LOG_LEVEL_KEYstatic StringLEVEL_IN_BRACKETS_KEYstatic StringLOG_FILE_KEYstatic StringLOG_KEY_PREFIXprotected Stringnamestatic StringSHOW_DATE_TIME_KEYstatic StringSHOW_LOG_NAME_KEYstatic StringSHOW_SHORT_LOG_NAME_KEYstatic StringSHOW_THREAD_NAME_KEYstatic StringSYSTEM_PREFIXAll system properties used byMockLoggerstart with this prefixstatic StringWARN_LEVEL_STRING_KEY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(String msg)A simple implementation which logs messages of level DEBUG according to the format outlined above.voiddebug(String format, Object param1)Perform single parameter substitution before logging the message of level DEBUG according to the format outlined above.voiddebug(String format, Object... argArray)Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.voiddebug(String format, Object param1, Object param2)Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.voiddebug(String msg, Throwable t)Log a message of level DEBUG, including an exception.voiderror(String msg)A simple implementation which always logs messages of level ERROR according to the format outlined above.voiderror(String format, Object arg)Perform single parameter substitution before logging the message of level ERROR according to the format outlined above.voiderror(String format, Object... argArray)Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.voiderror(String format, Object arg1, Object arg2)Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.voiderror(String msg, Throwable t)Log a message of level ERROR, including an exception.StringgetName()voidinfo(String msg)A simple implementation which logs messages of level INFO according to the format outlined above.voidinfo(String format, Object arg)Perform single parameter substitution before logging the message of level INFO according to the format outlined above.voidinfo(String format, Object... argArray)Perform double parameter substitution before logging the message of level INFO according to the format outlined above.voidinfo(String format, Object arg1, Object arg2)Perform double parameter substitution before logging the message of level INFO according to the format outlined above.voidinfo(String msg, Throwable t)Log a message of level INFO, including an exception.booleanisDebugEnabled()Aredebugmessages currently enabled?booleanisErrorEnabled()Areerrormessages currently enabled?booleanisInfoEnabled()Areinfomessages currently enabled?protected booleanisLevelEnabled(Level logLevel)Is the given log level currently enabled?booleanisTraceEnabled()Aretracemessages currently enabled?booleanisWarnEnabled()Arewarnmessages currently enabled?protected ObjectreadResolve()voidtrace(String msg)A simple implementation which logs messages of level TRACE according to the format outlined above.voidtrace(String format, Object param1)Perform single parameter substitution before logging the message of level TRACE according to the format outlined above.voidtrace(String format, Object... argArray)Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.voidtrace(String format, Object param1, Object param2)Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.voidtrace(String msg, Throwable t)Log a message of level TRACE, including an exception.voidwarn(String msg)A simple implementation which always logs messages of level WARN according to the format outlined above.voidwarn(String format, Object arg)Perform single parameter substitution before logging the message of level WARN according to the format outlined above.voidwarn(String format, Object... argArray)Perform double parameter substitution before logging the message of level WARN according to the format outlined above.voidwarn(String format, Object arg1, Object arg2)Perform double parameter substitution before logging the message of level WARN according to the format outlined above.voidwarn(String msg, 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
-
-
-
-
Field Detail
-
SYSTEM_PREFIX
public static final String SYSTEM_PREFIX
All system properties used byMockLoggerstart with this prefix- See Also:
- Constant Field Values
-
DEFAULT_LOG_LEVEL_KEY
public static final String DEFAULT_LOG_LEVEL_KEY
- See Also:
- Constant Field Values
-
SHOW_DATE_TIME_KEY
public static final String SHOW_DATE_TIME_KEY
- See Also:
- Constant Field Values
-
DATE_TIME_FORMAT_KEY
public static final String DATE_TIME_FORMAT_KEY
- See Also:
- Constant Field Values
-
SHOW_THREAD_NAME_KEY
public static final String SHOW_THREAD_NAME_KEY
- See Also:
- Constant Field Values
-
SHOW_LOG_NAME_KEY
public static final String SHOW_LOG_NAME_KEY
- See Also:
- Constant Field Values
-
SHOW_SHORT_LOG_NAME_KEY
public static final String SHOW_SHORT_LOG_NAME_KEY
- See Also:
- Constant Field Values
-
LOG_FILE_KEY
public static final String LOG_FILE_KEY
- See Also:
- Constant Field Values
-
LEVEL_IN_BRACKETS_KEY
public static final String LEVEL_IN_BRACKETS_KEY
- See Also:
- Constant Field Values
-
WARN_LEVEL_STRING_KEY
public static final String WARN_LEVEL_STRING_KEY
- See Also:
- Constant Field Values
-
LOG_KEY_PREFIX
public static final String LOG_KEY_PREFIX
- See Also:
- Constant Field Values
-
currentLogLevel
protected Level currentLogLevel
The current log level
-
name
protected 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()
Aretracemessages currently enabled?
-
trace
public void trace(String msg)
A simple implementation which logs messages of level TRACE according to the format outlined above.
-
trace
public void trace(String format, Object param1)
Perform single parameter substitution before logging the message of level TRACE according to the format outlined above.
-
trace
public void trace(String format, Object param1, Object param2)
Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
-
trace
public void trace(String format, Object... argArray)
Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.
-
trace
public void trace(String msg, Throwable t)
Log a message of level TRACE, including an exception.
-
isDebugEnabled
public boolean isDebugEnabled()
Aredebugmessages currently enabled?
-
debug
public void debug(String msg)
A simple implementation which logs messages of level DEBUG according to the format outlined above.
-
debug
public void debug(String format, Object param1)
Perform single parameter substitution before logging the message of level DEBUG according to the format outlined above.
-
debug
public void debug(String format, Object param1, Object param2)
Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
-
debug
public void debug(String format, Object... argArray)
Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.
-
debug
public void debug(String msg, Throwable t)
Log a message of level DEBUG, including an exception.
-
isInfoEnabled
public boolean isInfoEnabled()
Areinfomessages currently enabled?
-
info
public void info(String msg)
A simple implementation which logs messages of level INFO according to the format outlined above.
-
info
public void info(String format, Object arg)
Perform single parameter substitution before logging the message of level INFO according to the format outlined above.
-
info
public void info(String format, Object arg1, Object arg2)
Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
-
info
public void info(String format, Object... argArray)
Perform double parameter substitution before logging the message of level INFO according to the format outlined above.
-
info
public void info(String msg, Throwable t)
Log a message of level INFO, including an exception.
-
isWarnEnabled
public boolean isWarnEnabled()
Arewarnmessages currently enabled?
-
warn
public void warn(String msg)
A simple implementation which always logs messages of level WARN according to the format outlined above.
-
warn
public void warn(String format, Object arg)
Perform single parameter substitution before logging the message of level WARN according to the format outlined above.
-
warn
public void warn(String format, Object arg1, Object arg2)
Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
-
warn
public void warn(String format, Object... argArray)
Perform double parameter substitution before logging the message of level WARN according to the format outlined above.
-
warn
public void warn(String msg, Throwable t)
Log a message of level WARN, including an exception.
-
isErrorEnabled
public boolean isErrorEnabled()
Areerrormessages currently enabled?
-
error
public void error(String msg)
A simple implementation which always logs messages of level ERROR according to the format outlined above.
-
error
public void error(String format, Object arg)
Perform single parameter substitution before logging the message of level ERROR according to the format outlined above.
-
error
public void error(String format, Object arg1, Object arg2)
Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
-
error
public void error(String format, Object... argArray)
Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.
-
error
public void error(String msg, Throwable t)
Log a message of level ERROR, including an exception.
-
getName
public String getName()
- Specified by:
getNamein interfaceorg.slf4j.Logger
-
readResolve
protected Object readResolve() throws ObjectStreamException
- Throws:
ObjectStreamException
-
-