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.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 String
DATE_TIME_FORMAT_KEY
static String
DEFAULT_LOG_LEVEL_KEY
static String
LEVEL_IN_BRACKETS_KEY
static String
LOG_FILE_KEY
static String
LOG_KEY_PREFIX
protected String
name
static String
SHOW_DATE_TIME_KEY
static String
SHOW_LOG_NAME_KEY
static String
SHOW_SHORT_LOG_NAME_KEY
static String
SHOW_THREAD_NAME_KEY
static String
SYSTEM_PREFIX
All system properties used byMockLogger
start with this prefixstatic String
WARN_LEVEL_STRING_KEY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
debug(String msg)
A simple implementation which logs messages of level DEBUG according to the format outlined above.void
debug(String format, Object param1)
Perform single parameter substitution before logging the message of level DEBUG according to the format outlined above.void
debug(String format, Object... argArray)
Perform double parameter substitution before logging the message of level DEBUG according to the format outlined above.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.void
debug(String msg, Throwable t)
Log a message of level DEBUG, including an exception.void
error(String msg)
A simple implementation which always logs messages of level ERROR according to the format outlined above.void
error(String format, Object arg)
Perform single parameter substitution before logging the message of level ERROR according to the format outlined above.void
error(String format, Object... argArray)
Perform double parameter substitution before logging the message of level ERROR according to the format outlined above.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.void
error(String msg, Throwable t)
Log a message of level ERROR, including an exception.String
getName()
void
info(String msg)
A simple implementation which logs messages of level INFO according to the format outlined above.void
info(String format, Object arg)
Perform single parameter substitution before logging the message of level INFO according to the format outlined above.void
info(String format, Object... argArray)
Perform double parameter substitution before logging the message of level INFO according to the format outlined above.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.void
info(String msg, 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 Object
readResolve()
void
trace(String msg)
A simple implementation which logs messages of level TRACE according to the format outlined above.void
trace(String format, Object param1)
Perform single parameter substitution before logging the message of level TRACE according to the format outlined above.void
trace(String format, Object... argArray)
Perform double parameter substitution before logging the message of level TRACE according to the format outlined above.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.void
trace(String msg, Throwable t)
Log a message of level TRACE, including an exception.void
warn(String msg)
A simple implementation which always logs messages of level WARN according to the format outlined above.void
warn(String format, Object arg)
Perform single parameter substitution before logging the message of level WARN according to the format outlined above.void
warn(String format, Object... argArray)
Perform double parameter substitution before logging the message of level WARN according to the format outlined above.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.void
warn(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 byMockLogger
start 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()
Aretrace
messages 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()
Aredebug
messages 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()
Areinfo
messages 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()
Arewarn
messages 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()
Areerror
messages 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:
getName
in interfaceorg.slf4j.Logger
-
readResolve
protected Object readResolve() throws ObjectStreamException
- Throws:
ObjectStreamException
-
-