|
Log4j 1.3alpha-5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.Category | +--org.apache.log4j.Logger
This is the central class in the log4j package. Most logging operations, except configuration, are done through this class.
Field Summary |
Fields inherited from class org.apache.log4j.Category |
additive, level, lock, name, parent, repository, resourceBundle |
Constructor Summary | |
protected |
Logger(java.lang.String name)
This constructor creates a new Logger instance and sets
its name.
|
Method Summary | |
void |
fatal(java.lang.String messagePattern,
java.lang.Object arg1,
java.lang.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(java.lang.Class clazz)
Shorthand for . |
static Logger |
getLogger(java.lang.String name)
Retrieve a logger by name. |
static Logger |
getLogger(java.lang.String name,
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 of logger for the current hierarchy. |
void |
trace(java.lang.Object message)
Log a message object with the TRACE level. |
void |
trace(java.lang.Object messagePattern,
java.lang.Object arg)
Log a message with the TRACE level with message formatting
done according to the value of messagePattern and
arg parameters.
|
void |
trace(java.lang.Object message,
java.lang.Throwable t)
Log a message object with the TRACE level including the
stack trace of the Throwable t passed as parameter.
|
void |
trace(java.lang.String messagePattern,
java.lang.Object arg1,
java.lang.Object arg2)
Log a message with the TRACE level with message formatting
done according to the messagePattern and the arguments arg1 and arg2.
|
Methods inherited from class org.apache.log4j.Category |
addAppender, assertLog, callAppenders, debug, debug, debug, debug, error, error, error, error, exists, fatal, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getInstance, getInstance, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, info, info, isAttached, isDebugEnabled, isEnabledFor, isEnabledFor, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, l7dlog, l7dlog, log, log, log, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, setResourceBundle, shutdown, warn, warn, warn, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Logger(java.lang.String name)
Logger
instance and sets
its name.
It is intended to be used by sub-classes only. You should not create loggers directly.
name
- The name of the logger.Method Detail |
public static Logger getLogger(java.lang.String name)
By default, loggers do not have a set level but inherit it from their ancestors. This is one of the central features of log4j.
name
- The name of the logger to retrieve.public static Logger getLogger(java.lang.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 root logger is always instantiated and available. It's name is "root".
Nevertheless, note that calling Logger.getLogger("root")
does not retrieve the root logger but a logger just under root named
"root".
public static Logger getLogger(java.lang.String name, 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(java.lang.Object message)
TRACE
level.
message
- the message object to log.for an explanation of the logic applied.
public void trace(java.lang.Object message, java.lang.Throwable t)
TRACE
level including the
stack trace of the Throwable
t
passed as parameter.
See Category.debug(Object)
form for more detailed information.
message
- the message object to log.t
- the exception to log, including its stack trace.public void trace(java.lang.Object messagePattern, java.lang.Object arg)
TRACE
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.
messagePattern
- The message pattern which will be parsed and formattedarg
- The argument to replace the formatting element, i,e,
the '{}' pair within messagePattern
.public void trace(java.lang.String messagePattern, java.lang.Object arg1, java.lang.Object arg2)
TRACE
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.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting elementpublic void fatal(java.lang.String messagePattern, java.lang.Object arg1, java.lang.Object arg2)
FATAL
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.
messagePattern
- The message pattern which will be parsed and formattedarg1
- The first argument to replace the first formatting elementarg2
- The second argument to replace the second formatting element
|
Log4j 1.3alpha-5 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |