Package org.opennms.core.test
Class MockLogger
- java.lang.Object
-
- org.slf4j.helpers.MarkerIgnoringBase
-
- org.opennms.core.test.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 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 Level
currentLogLevel
The current log levelstatic java.lang.String
DATE_TIME_FORMAT_KEY
static java.lang.String
DEFAULT_LOG_LEVEL_KEY
static java.lang.String
LEVEL_IN_BRACKETS_KEY
static java.lang.String
LOG_FILE_KEY
static java.lang.String
LOG_KEY_PREFIX
protected java.lang.String
name
static java.lang.String
SHOW_DATE_TIME_KEY
static java.lang.String
SHOW_LOG_NAME_KEY
static java.lang.String
SHOW_SHORT_LOG_NAME_KEY
static java.lang.String
SHOW_THREAD_NAME_KEY
static java.lang.String
SYSTEM_PREFIX
All system properties used byMockLogger
start with this prefixstatic java.lang.String
WARN_LEVEL_STRING_KEY
-
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()
Aredebug
messages currently enabled?boolean
isErrorEnabled()
Areerror
messages currently enabled?boolean
isInfoEnabled()
Areinfo
messages currently enabled?protected boolean
isLevelEnabled(Level logLevel)
Is the given log level currently enabled?boolean
isTraceEnabled()
Aretrace
messages currently enabled?boolean
isWarnEnabled()
Arewarn
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
-
-
-
-
Field Detail
-
SYSTEM_PREFIX
public static final java.lang.String SYSTEM_PREFIX
All system properties used byMockLogger
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
-
LOG_FILE_KEY
public static final java.lang.String LOG_FILE_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
-
LOG_KEY_PREFIX
public static final java.lang.String LOG_KEY_PREFIX
- 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()
Aretrace
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()
Aredebug
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()
Areinfo
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()
Arewarn
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()
Areerror
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 interfaceorg.slf4j.Logger
-
readResolve
protected java.lang.Object readResolve() throws java.io.ObjectStreamException
- Throws:
java.io.ObjectStreamException
-
-