public class Logger extends Category
additive, level, LOG4J_FQCN, m_delegate, m_paxLogging, name, parent, repository| Modifier | Constructor and Description |
|---|---|
protected |
Logger(String name) |
protected |
Logger(String name,
PaxLogger delegate) |
| Modifier and Type | Method and Description |
|---|---|
void |
assertLog(boolean assertion,
String msg)
|
void |
debug(Object message)
Log a message object with the
DEBUG level. |
void |
debug(Object messagePattern,
Object arg)
Log a message with the
DEBUG level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
debug(Object message,
Throwable t)
Log a message object with the
DEBUG level including the stack trace of the Throwable
t passed as parameter. |
void |
debug(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
DEBUG level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
void |
error(Object message)
Log a message object with the
ERROR Level. |
void |
error(Object messagePattern,
Object arg)
Log a message with the
ERROR level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
error(Object message,
Throwable t)
Log a message object with the
ERROR level including the stack trace of the Throwable
t passed as parameter. |
void |
error(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
ERROR level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
void |
fatal(Object message)
Log a message object with the
FATAL Level. |
void |
fatal(Object messagePattern,
Object arg)
Log a message with the
FATAL level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
fatal(Object message,
Throwable t)
Log a message object with the
FATAL level including the stack trace of the Throwable
t passed as parameter. |
void |
fatal(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
FATAL level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
static Logger |
getLogger(Class clazz)
Shorthand for
getLogger(clazz.getName()). |
static Logger |
getLogger(String name)
Retrieve a logger named according to the value of the
name parameter. |
static Logger |
getLogger(String name,
org.apache.log4j.spi.LoggerFactory factory)
Like
getLogger(String) except that the type of logger instantiated depends on the type returned by the
LoggerFactory.makeNewLoggerInstance(java.lang.String) method of the
factory parameter. |
static Logger |
getRootLogger()
Return the root logger for the current logger repository.
|
void |
info(Object message)
Log a message object with the
INFO Level. |
void |
info(Object messagePattern,
Object arg)
Log a message with the
INFO level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
info(Object message,
Throwable t)
Log a message object with the
INFO level including the stack trace of the Throwable
t passed as parameter. |
void |
info(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
INFO level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
boolean |
isTraceEnabled()
Check whether this category is enabled for the TRACE Level.
|
void |
log(Priority priority,
Object message)
This generic form is intended to be used by wrappers.
|
void |
log(Priority priority,
Object message,
Throwable t)
This generic form is intended to be used by wrappers.
|
void |
log(String callerFQCN,
Priority level,
Object message,
Throwable t)
This is the most generic printing method.
|
void |
trace(Object message)
Log a message object with the
TRACE level. |
void |
trace(Object messagePattern,
Object arg)
Log a message with the
TRACE level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
trace(Object message,
Throwable t)
Log a message object with the
TRACE level including the stack trace of the
Throwablet passed as parameter. |
void |
trace(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
TRACE level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
void |
warn(Object message)
Log a message object with the
WARN Level. |
void |
warn(Object messagePattern,
Object arg)
Log a message with the
WARN level with message formatting
done according to the value of messagePattern and
arg parameters. |
void |
warn(Object message,
Throwable t)
|
void |
warn(String messagePattern,
Object arg1,
Object arg2)
Log a message with the
WARN level with message formatting
done according to the messagePattern and the arguments arg1 and arg2. |
addAppender, callAppenders, configurePaxLoggingManager, exists, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getInstance, getInstance, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, isAttached, isDebugEnabled, isEnabledFor, isErrorEnabled, isInfoEnabled, isWarnEnabled, l7dlog, l7dlog, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, setPaxLoggingManager, setPriority, setResourceBundle, shutdownprotected Logger(String name)
public static Logger getLogger(String name)
name parameter. If the named logger already
exists, then the existing instance will be returned. Otherwise, a new instance is created.
By default, loggers do not have a set level but inherit it from their neareast ancestor with a set level. This is one of the central features of log4j.
In pax-logging, loggers are obtained from current or fallback PaxLoggingManager
name - The name of the logger to retrieve.public static Logger getLogger(Class clazz)
getLogger(clazz.getName()).clazz - The name of clazz will be used as the name of the logger to retrieve. See
getLogger(String) for more detailed information.public static Logger getRootLogger()
The Logger.getName() method for the root logger always returns string value: "root". However,
calling
Logger.getLogger("root") does not retrieve the root logger but a
logger just under root named "root".
In other words, calling this method is the only way to retrieve the root logger.
public static Logger getLogger(String name, org.apache.log4j.spi.LoggerFactory factory)
getLogger(String) except that the type of logger instantiated depends on the type returned by the
LoggerFactory.makeNewLoggerInstance(java.lang.String) method of the
factory parameter.
This method is intended to be used by sub-classes.
name - The name of the logger to retrieve.factory - A LoggerFactory implementation that will actually create a new Instance.public void trace(Object message)
TRACE level.trace in class Categorymessage - the message object to log.for an explanation of the logic applied.public void trace(Object message, Throwable t)
TRACE level including the stack trace of the
Throwablet passed as parameter.
See debug(Object) form for more detailed information.
public void trace(Object messagePattern, Object arg)
CategoryTRACE level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void trace(String messagePattern, Object arg1, Object arg2)
CategoryTRACE level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public boolean isTraceEnabled()
isTraceEnabled in class Categorytrue if this category is enabled for level TRACE, false otherwise.public void debug(Object message)
CategoryDEBUG level.
This method first checks if this category is DEBUG enabled by comparing the level of this category
with the DEBUG level. If this category is DEBUG enabled, then it converts the
message object (passed as parameter) to a string by invoking the appropriate
ObjectRenderer. It then proceeds to call all the registered appenders in this
category and also higher in the hierarchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable to this method will
print the name of the Throwable but no stack trace. To print a stack trace use the
Category.debug(Object, Throwable) form instead.
public void debug(Object message, Throwable t)
CategoryDEBUG level including the stack trace of the Throwable
t passed as parameter.
See Category.debug(Object) form for more detailed information.
public void debug(Object messagePattern, Object arg)
CategoryDEBUG level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void debug(String messagePattern, Object arg1, Object arg2)
CategoryDEBUG level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void error(Object message)
CategoryERROR Level.
This method first checks if this category is ERROR enabled by comparing the level of this category
with ERROR Level. If this category is ERROR enabled, then it converts the
message object passed as parameter to a string by invoking the appropriate
ObjectRenderer. It proceeds to call all the registered appenders in this category and
also higher in the hierarchy depending on the value of the additivity flag.
WARNING Note that passing a Throwable to this method will
print the name of the Throwable but no stack trace. To print a stack trace use the
Category.error(Object, Throwable) form instead.
public void error(Object message, Throwable t)
CategoryERROR level including the stack trace of the Throwable
t passed as parameter.
See Category.error(Object) form for more detailed information.
public void error(Object messagePattern, Object arg)
CategoryERROR level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void error(String messagePattern, Object arg1, Object arg2)
CategoryERROR level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void fatal(Object message)
CategoryFATAL Level.
This method first checks if this category is FATAL enabled by comparing the level of this category
with FATAL Level. If the category is FATAL enabled, then it converts the message
object passed as parameter to a string by invoking the appropriate ObjectRenderer. It
proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the
value of the additivity flag.
WARNING Note that passing a Throwable to this method will
print the name of the Throwable but no stack trace. To print a stack trace use the
Category.fatal(Object, Throwable) form instead.
public void fatal(Object message, Throwable t)
CategoryFATAL level including the stack trace of the Throwable
t passed as parameter.
See Category.fatal(Object) for more detailed information.
public void fatal(Object messagePattern, Object arg)
CategoryFATAL level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void fatal(String messagePattern, Object arg1, Object arg2)
CategoryFATAL level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void info(Object message)
CategoryINFO Level.
This method first checks if this category is INFO enabled by comparing the level of this category
with INFO Level. If the category is INFO enabled, then it converts the message
object passed as parameter to a string by invoking the appropriate ObjectRenderer. It
proceeds to call all the registered appenders in this category and also higher in the hierarchy depending on the
value of the additivity flag.
WARNING Note that passing a Throwable to this method will
print the name of the Throwable but no stack trace. To print a stack trace use the
Category.info(Object, Throwable) form instead.
public void info(Object message, Throwable t)
CategoryINFO level including the stack trace of the Throwable
t passed as parameter.
See Category.info(Object) for more detailed information.
public void info(Object messagePattern, Object arg)
CategoryINFO level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void info(String messagePattern, Object arg1, Object arg2)
CategoryINFO level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void warn(Object message)
CategoryWARN Level.
This method first checks if this category is WARN enabled by comparing the level of this category
with WARN Level. If the category is WARN enabled, then it converts the message
object passed as parameter to a string by invoking the appropriate ObjectRenderer. It
proceeds to call all the registered appenders in this category and also higher in the hieararchy depending on the
value of the additivity flag.
WARNING Note that passing a Throwable to this method will
print the name of the Throwable but no stack trace. To print a stack trace use the
Category.warn(Object, Throwable) form instead.
public void warn(Object message, Throwable t)
CategoryWARN level including the stack trace of the Throwable t
passed as parameter.
See Category.warn(Object) for more detailed information.
public void warn(Object messagePattern, Object arg)
CategoryWARN level with message formatting
done according to the value of messagePattern and
arg parameters.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void warn(String messagePattern, Object arg1, Object arg2)
CategoryWARN level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
This form avoids superflous parameter construction. Whenever possible, you should use this form instead of constructing the message parameter using string concatenation.
public void assertLog(boolean assertion,
String msg)
Categoryassertion parameter is false, then logs
msg as an error statement.
The assert method has been renamed to assertLog because assert is a
language reserved word in JDK 1.4.
public void log(Priority priority, Object message, Throwable t)
Categorypublic void log(Priority priority, Object message)
CategoryCopyright © 2006–2024 OPS4J - Open Participation Software for Java. All rights reserved.