|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.dna.common.util.Logger
@ThreadSafe public final class Logger
A simple logging interface that is fully compatible with multiple logging implementations. This interface does take advantage of the variable arguments and autoboxing features in Java 5, reducing the number of methods that are necessary and allowing callers to supply primitive values as parameters.
Nested Class Summary | |
---|---|
static class |
Logger.Level
|
Method Summary | |
---|---|
void |
debug(java.lang.String message,
java.lang.Object... params)
Log a message at the DEBUG level according to the specified format and (optional) parameters. |
void |
debug(java.lang.Throwable t,
java.lang.String message,
java.lang.Object... params)
Log an exception (throwable) at the DEBUG level with an accompanying message. |
void |
error(I18n message,
java.lang.Object... params)
Log a message at the ERROR level according to the specified format and (optional) parameters. |
void |
error(java.lang.Throwable t,
I18n message,
java.lang.Object... params)
Log an exception (throwable) at the ERROR level with an accompanying message. |
Logger.Level |
getLevel()
Get the logging level at which this logger is current set. |
static Logger |
getLogger(java.lang.Class clazz)
Return a logger named corresponding to the class passed as parameter, using the statically bound ILoggerFactory
instance. |
static Logger |
getLogger(java.lang.String name)
Return a logger named according to the name parameter using the statically bound ILoggerFactory instance. |
static java.util.Locale |
getLoggingLocale()
Get the locale used for the logs. |
java.lang.String |
getName()
Return the name of this logger instance. |
void |
info(I18n message,
java.lang.Object... params)
Log a message at the INFO level according to the specified format and (optional) parameters. |
void |
info(java.lang.Throwable t,
I18n message,
java.lang.Object... params)
Log an exception (throwable) at the INFO level with an accompanying message. |
boolean |
isDebugEnabled()
Return whether messages at the DEBUG level are being logged. |
boolean |
isErrorEnabled()
Return whether messages at the ERROR level are being logged. |
boolean |
isInfoEnabled()
Return whether messages at the INFORMATION level are being logged. |
boolean |
isTraceEnabled()
Return whether messages at the TRACE level are being logged. |
boolean |
isWarnEnabled()
Return whether messages at the WARNING level are being logged. |
void |
log(Logger.Level level,
I18n message,
java.lang.Object... params)
Log a message at the suplied level according to the specified format and (optional) parameters. |
void |
log(Logger.Level level,
java.lang.Throwable t,
I18n message,
java.lang.Object... params)
Log an exception (throwable) at the supplied level with an accompanying message. |
static java.util.Locale |
setLoggingLocale(java.util.Locale locale)
Set the locale used for the logs. |
void |
trace(java.lang.String message,
java.lang.Object... params)
Log a message at the TRACE level according to the specified format and (optional) parameters. |
void |
trace(java.lang.Throwable t,
java.lang.String message,
java.lang.Object... params)
Log an exception (throwable) at the TRACE level with an accompanying message. |
void |
warn(I18n message,
java.lang.Object... params)
Log a message at the WARNING level according to the specified format and (optional) parameters. |
void |
warn(java.lang.Throwable t,
I18n message,
java.lang.Object... params)
Log an exception (throwable) at the WARNING level with an accompanying message. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.util.Locale getLoggingLocale()
default locale
is used.
setLoggingLocale(Locale)
public static java.util.Locale setLoggingLocale(java.util.Locale locale)
default locale
. To use the default locale, call this method with a null value.
locale
- the desired locale to use for the logs, or null if the system locale should be used
getLoggingLocale()
public static Logger getLogger(java.lang.Class clazz)
ILoggerFactory
instance.
clazz
- the returned logger will be named after clazz
public static Logger getLogger(java.lang.String name)
ILoggerFactory
instance.
name
- The name of the logger.
public java.lang.String getName()
public void log(Logger.Level level, I18n message, java.lang.Object... params)
level
- the level at which to logmessage
- the (localized) message stringparams
- the parameter values that are to replace the variables in the format stringpublic void log(Logger.Level level, java.lang.Throwable t, I18n message, java.lang.Object... params)
debug(String, Object...)
.
level
- the level at which to logt
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic void debug(java.lang.String message, java.lang.Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic void debug(java.lang.Throwable t, java.lang.String message, java.lang.Object... params)
debug(String, Object...)
.
t
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic void error(I18n message, java.lang.Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic void error(java.lang.Throwable t, I18n message, java.lang.Object... params)
error(I18n, Object...)
.
t
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic void info(I18n message, java.lang.Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic void info(java.lang.Throwable t, I18n message, java.lang.Object... params)
info(I18n, Object...)
.
t
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic void trace(java.lang.String message, java.lang.Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic void trace(java.lang.Throwable t, java.lang.String message, java.lang.Object... params)
trace(String, Object...)
.
t
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic void warn(I18n message, java.lang.Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic void warn(java.lang.Throwable t, I18n message, java.lang.Object... params)
warn(I18n, Object...)
.
t
- the exception (throwable) to logmessage
- the message accompanying the exceptionparams
- the parameter values that are to replace the variables in the format stringpublic boolean isInfoEnabled()
public boolean isWarnEnabled()
public boolean isErrorEnabled()
public boolean isDebugEnabled()
public boolean isTraceEnabled()
public Logger.Level getLevel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |