public class Logger
extends java.lang.Object
This class implements a thin wrapper around a subset of methods of
the Logger
class from the SLF4J facade, in order to allow
those methods commonly used by the toolkit to be usable without invoking
a runtime dependency on the SLF4J jar files.
For how to configure the logger properties, see the package description.
LoggerFactory
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
className |
protected java.text.SimpleDateFormat |
dateFormatter |
protected boolean |
debugEnabled |
protected boolean |
errorEnabled |
protected boolean |
infoEnabled |
protected static long |
millisecondsSinceEpochAtStart |
protected static boolean |
millisecondsSinceEpochAtStartIsSet |
protected boolean |
showDateTime |
protected org.slf4j.Logger |
slf4jlogger |
protected boolean |
traceEnabled |
protected boolean |
warnEnabled |
Modifier | Constructor and Description |
---|---|
protected |
Logger(org.slf4j.Logger slf4jlogger)
Construct a logger that uses an slf4j Logger.
|
protected |
Logger(java.lang.String className)
Construct a default logger named corresponding to the class name passed as parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
debug(java.lang.String msg)
Log a message at the DEBUG level.
|
void |
debug(java.lang.String format,
java.lang.Object... arguments)
Log a message at the DEBUG level.
|
void |
debug(java.lang.String msg,
java.lang.Throwable t)
Log an exception (throwable) at the DEBUG level with an accompanying message.
|
void |
error(java.lang.String msg)
Log a message at the ERROR level.
|
void |
error(java.lang.String format,
java.lang.Object... arguments)
Log a message at the ERROR level.
|
void |
error(java.lang.String msg,
java.lang.Throwable t)
Log an exception (throwable) at the ERROR level with an accompanying message.
|
protected static java.lang.String |
getFormattedStringFromArguments(java.lang.String format,
java.lang.Object... arguments) |
protected java.lang.String |
getPreamable(java.lang.String level) |
void |
info(java.lang.String msg)
Log a message at the INFO level.
|
void |
info(java.lang.String format,
java.lang.Object... arguments)
Log a message at the INFO level.
|
void |
info(java.lang.String msg,
java.lang.Throwable t)
Log an exception (throwable) at the INFO level with an accompanying message.
|
boolean |
isDebugEnabled()
Is the logger instance enabled for the DEBUG level?
|
boolean |
isErrorEnabled()
Is the logger instance enabled for the ERROR level?
|
boolean |
isInfoEnabled()
Is the logger instance enabled for the INFO level?
|
boolean |
isTraceEnabled()
Is the logger instance enabled for the TRACE level?
|
boolean |
isWarnEnabled()
Is the logger instance enabled for the WARN level?
|
protected void |
setLoggingDetailLevel(java.lang.String level) |
void |
trace(java.lang.String msg)
Log a message at the TRACE level.
|
void |
trace(java.lang.String format,
java.lang.Object... arguments)
Log a message at the TRACE level.
|
void |
trace(java.lang.String msg,
java.lang.Throwable t)
Log an exception (throwable) at the TRACE level with an accompanying message.
|
void |
warn(java.lang.String msg)
Log a message at the WARN level.
|
void |
warn(java.lang.String format,
java.lang.Object... arguments)
Log a message at the WARN level.
|
void |
warn(java.lang.String msg,
java.lang.Throwable t)
Log an exception (throwable) at the WARN level with an accompanying message.
|
protected java.lang.String className
protected java.text.SimpleDateFormat dateFormatter
protected boolean debugEnabled
protected boolean errorEnabled
protected boolean infoEnabled
protected static long millisecondsSinceEpochAtStart
protected static boolean millisecondsSinceEpochAtStartIsSet
protected boolean showDateTime
protected org.slf4j.Logger slf4jlogger
protected boolean traceEnabled
protected boolean warnEnabled
protected Logger(org.slf4j.Logger slf4jlogger)
Construct a logger that uses an slf4j Logger.
slf4jlogger
- an slf4jloggerprotected Logger(java.lang.String className)
Construct a default logger named corresponding to the class name passed as parameter.
className
- the name of the loggerpublic void debug(java.lang.String msg)
Log a message at the DEBUG level.
msg
- the message string to be loggedpublic void debug(java.lang.String format, java.lang.Object... arguments)
Log a message at the DEBUG level.
format
- the format stringarguments
- a list of 1 or more argumentspublic void debug(java.lang.String msg, java.lang.Throwable t)
Log an exception (throwable) at the DEBUG level with an accompanying message.
msg
- the message accompanying the exceptiont
- the exception (throwable) to logpublic void error(java.lang.String msg)
Log a message at the ERROR level.
msg
- the message string to be loggedpublic void error(java.lang.String format, java.lang.Object... arguments)
Log a message at the ERROR level.
format
- the format stringarguments
- a list of 1 or more argumentspublic void error(java.lang.String msg, java.lang.Throwable t)
Log an exception (throwable) at the ERROR level with an accompanying message.
msg
- the message accompanying the exceptiont
- the exception (throwable) to logprotected static java.lang.String getFormattedStringFromArguments(java.lang.String format, java.lang.Object... arguments)
protected java.lang.String getPreamable(java.lang.String level)
public void info(java.lang.String msg)
Log a message at the INFO level.
msg
- the message string to be loggedpublic void info(java.lang.String format, java.lang.Object... arguments)
Log a message at the INFO level.
format
- the format stringarguments
- a list of 1 or more argumentspublic void info(java.lang.String msg, java.lang.Throwable t)
Log an exception (throwable) at the INFO level with an accompanying message.
msg
- the message accompanying the exceptiont
- the exception (throwable) to logpublic boolean isDebugEnabled()
Is the logger instance enabled for the DEBUG level?
return True if this Logger is enabled for the DEBUG level, false otherwise.public boolean isErrorEnabled()
Is the logger instance enabled for the ERROR level?
return True if this Logger is enabled for the ERROR level, false otherwise.public boolean isInfoEnabled()
Is the logger instance enabled for the INFO level?
return True if this Logger is enabled for the INFO level, false otherwise.public boolean isTraceEnabled()
Is the logger instance enabled for the TRACE level?
return True if this Logger is enabled for the TRACE level, false otherwise.public boolean isWarnEnabled()
Is the logger instance enabled for the WARN level?
return True if this Logger is enabled for the WARN level, false otherwise.protected void setLoggingDetailLevel(java.lang.String level)
public void trace(java.lang.String msg)
Log a message at the TRACE level.
msg
- the message string to be loggedpublic void trace(java.lang.String format, java.lang.Object... arguments)
Log a message at the TRACE level.
format
- the format stringarguments
- a list of 1 or more argumentspublic void trace(java.lang.String msg, java.lang.Throwable t)
Log an exception (throwable) at the TRACE level with an accompanying message.
msg
- the message accompanying the exceptiont
- the exception (throwable) to logpublic void warn(java.lang.String msg)
Log a message at the WARN level.
msg
- the message string to be loggedpublic void warn(java.lang.String format, java.lang.Object... arguments)
Log a message at the WARN level.
format
- the format stringarguments
- a list of 1 or more argumentspublic void warn(java.lang.String msg, java.lang.Throwable t)
Log an exception (throwable) at the WARN level with an accompanying message.
msg
- the message accompanying the exceptiont
- the exception (throwable) to log