org.apache.log4j
public class Logger extends Category
Since: log4j 1.2
Constructor Summary | |
---|---|
protected | Logger(String name) |
Method Summary | |
---|---|
static Logger | getLogger(String name)
Retrieve a logger named according to the value of the
name parameter. |
static Logger | getLogger(Class clazz)
Shorthand for getLogger(clazz.getName()) .
|
static Logger | getLogger(String name, LoggerFactory factory)
Like {@link #getLogger(String)} except that the type of logger
instantiated depends on the type returned by the {@link
LoggerFactory#makeNewLoggerInstance} method of the
factory parameter.
|
static Logger | getRootLogger()
Return the root logger for the current logger repository.
|
boolean | isTraceEnabled()
Check whether this category is enabled for the TRACE Level. |
void | trace(Object message)
Log a message object with the {@link org.apache.log4j.Level#TRACE TRACE} level.
|
void | trace(Object message, Throwable t)
Log a message object with the TRACE level including the
stack trace of the {@link Throwable}t passed as parameter.
|
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.
Parameters: name The name of the logger to retrieve.
getLogger(clazz.getName())
.
Parameters: clazz The name of clazz
will be used as the
name of the logger to retrieve. See {@link #getLogger(String)}
for more detailed information.
factory
parameter.
This method is intended to be used by sub-classes.
Parameters: name The name of the logger to retrieve. factory A {@link LoggerFactory} implementation that will actually create a new Instance.
Since: 0.8.5
The {@link #getName Logger.getName()} method for the root logger always returns
stirng 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.
Returns: boolean - true
if this category is enabled for level
TRACE, false
otherwise.
Since: 1.2.12
Parameters: message the message object to log.
Since: 1.2.12
See Also: for an explanation of the logic applied.
TRACE
level including the
stack trace of the {@link Throwable}t
passed as parameter.
See {@link #debug(Object)} form for more detailed information.
Parameters: message the message object to log. t the exception to log, including its stack trace.
Since: 1.2.12