|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.common.util.Logger
@ThreadSafe public abstract class Logger
A simple logging interface that is fully compatible with multiple logging implementations. If no log4j implementation is found, then its defaulted to the JDK Logger implementation. 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
|
Field Summary | |
---|---|
protected static AtomicReference<Locale> |
LOGGING_LOCALE
|
Constructor Summary | |
---|---|
Logger()
|
Method Summary | |
---|---|
abstract void |
debug(String message,
Object... params)
Log a message at the DEBUG level according to the specified format and (optional) parameters. |
abstract void |
debug(Throwable t,
String message,
Object... params)
Log an exception (throwable) at the DEBUG level with an accompanying message. |
abstract void |
error(I18n message,
Object... params)
Log a message at the ERROR level according to the specified format and (optional) parameters. |
abstract void |
error(Throwable t,
I18n message,
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(Class<?> clazz)
Return a logger named corresponding to the class passed as parameter. |
static Logger |
getLogger(String name)
Return a logger named according to the name parameter. |
static Locale |
getLoggingLocale()
Get the locale used for the logs. |
abstract String |
getName()
Return the name of this logger instance. |
abstract void |
info(I18n message,
Object... params)
Log a message at the INFO level according to the specified format and (optional) parameters. |
abstract void |
info(Throwable t,
I18n message,
Object... params)
Log an exception (throwable) at the INFO level with an accompanying message. |
abstract boolean |
isDebugEnabled()
Return whether messages at the DEBUG level are being logged. |
abstract boolean |
isErrorEnabled()
Return whether messages at the ERROR level are being logged. |
abstract boolean |
isInfoEnabled()
Return whether messages at the INFORMATION level are being logged. |
abstract boolean |
isTraceEnabled()
Return whether messages at the TRACE level are being logged. |
abstract boolean |
isWarnEnabled()
Return whether messages at the WARNING level are being logged. |
void |
log(Logger.Level level,
I18n message,
Object... params)
Log a message at the suplied level according to the specified format and (optional) parameters. |
void |
log(Logger.Level level,
Throwable t,
I18n message,
Object... params)
Log an exception (throwable) at the supplied level with an accompanying message. |
static Locale |
setLoggingLocale(Locale locale)
Set the locale used for the logs. |
abstract void |
trace(String message,
Object... params)
Log a message at the TRACE level according to the specified format and (optional) parameters. |
abstract void |
trace(Throwable t,
String message,
Object... params)
Log an exception (throwable) at the TRACE level with an accompanying message. |
abstract void |
warn(I18n message,
Object... params)
Log a message at the WARNING level according to the specified format and (optional) parameters. |
abstract void |
warn(Throwable t,
I18n message,
Object... params)
Log an exception (throwable) at the WARNING level with an accompanying message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final AtomicReference<Locale> LOGGING_LOCALE
Constructor Detail |
---|
public Logger()
Method Detail |
---|
public static Locale getLoggingLocale()
default locale
is used.
setLoggingLocale(Locale)
public static Locale setLoggingLocale(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(Class<?> clazz)
clazz
- the returned logger will be named after clazz
public static Logger getLogger(String name)
name
- The name of the logger.
public abstract String getName()
public void log(Logger.Level level, I18n message, 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, Throwable t, I18n message, 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 abstract void debug(String message, Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic abstract void debug(Throwable t, String message, 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 abstract void error(I18n message, Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic abstract void error(Throwable t, I18n message, 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 abstract void info(I18n message, Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic abstract void info(Throwable t, I18n message, 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 abstract void trace(String message, Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic abstract void trace(Throwable t, String message, 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 abstract void warn(I18n message, Object... params)
message
- the message stringparams
- the parameter values that are to replace the variables in the format stringpublic abstract void warn(Throwable t, I18n message, 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 abstract boolean isInfoEnabled()
public abstract boolean isWarnEnabled()
public abstract boolean isErrorEnabled()
public abstract boolean isDebugEnabled()
public abstract boolean isTraceEnabled()
public Logger.Level getLevel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |