Package org.apache.commons.logging.impl
Class Log4JLogger
java.lang.Object
org.apache.commons.logging.impl.Log4JLogger
- All Implemented Interfaces:
Serializable
,Log
Implementation of
Log
that maps directly to a
Logger for log4J version 1.2.
Initial configuration of the corresponding Logger instances should be done in the usual manner, as outlined in the Log4J documentation.
The reason this logger is distinct from the 1.3 logger is that in version 1.2 of Log4J:
- class Logger takes Priority parameters not Level parameters.
- class Level extends Priority
- Version:
- $Id: Log4JLogger.java 1448119 2013-02-20 12:28:04Z tn $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
The fully qualified name of the Log4JLogger class.private org.apache.log4j.Logger
Log to this loggerprivate final String
Logger nameprivate static final long
Serializable version identifier.private static final org.apache.log4j.Priority
-
Constructor Summary
ConstructorsConstructorDescriptionLog4JLogger
(String name) Base constructor.Log4JLogger
(org.apache.log4j.Logger logger) For use with a log4j factory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Logs a message withorg.apache.log4j.Priority.DEBUG
.void
Logs a message withorg.apache.log4j.Priority.DEBUG
.void
Logs a message withorg.apache.log4j.Priority.ERROR
.void
Logs a message withorg.apache.log4j.Priority.ERROR
.void
Logs a message withorg.apache.log4j.Priority.FATAL
.void
Logs a message withorg.apache.log4j.Priority.FATAL
.org.apache.log4j.Logger
Return the native Logger instance we are using.void
Logs a message withorg.apache.log4j.Priority.INFO
.void
Logs a message withorg.apache.log4j.Priority.INFO
.boolean
Check whether the Log4j Logger used is enabled forDEBUG
priority.boolean
Check whether the Log4j Logger used is enabled forERROR
priority.boolean
Check whether the Log4j Logger used is enabled forFATAL
priority.boolean
Check whether the Log4j Logger used is enabled forINFO
priority.boolean
Check whether the Log4j Logger used is enabled forTRACE
priority.boolean
Check whether the Log4j Logger used is enabled forWARN
priority.void
Logs a message withorg.apache.log4j.Priority.TRACE
.void
Logs a message withorg.apache.log4j.Priority.TRACE
.void
Logs a message withorg.apache.log4j.Priority.WARN
.void
Logs a message withorg.apache.log4j.Priority.WARN
.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerializable version identifier.- See Also:
-
FQCN
The fully qualified name of the Log4JLogger class. -
logger
private transient volatile org.apache.log4j.Logger loggerLog to this logger -
name
Logger name -
traceLevel
private static final org.apache.log4j.Priority traceLevel
-
-
Constructor Details
-
Log4JLogger
public Log4JLogger() -
Log4JLogger
Base constructor. -
Log4JLogger
public Log4JLogger(org.apache.log4j.Logger logger) For use with a log4j factory.
-
-
Method Details
-
trace
Logs a message withorg.apache.log4j.Priority.TRACE
. When using a log4j version that does not support theTRACE
level, the message will be logged at theDEBUG
level. -
trace
Logs a message withorg.apache.log4j.Priority.TRACE
. When using a log4j version that does not support theTRACE
level, the message will be logged at theDEBUG
level. -
debug
Logs a message withorg.apache.log4j.Priority.DEBUG
. -
debug
Logs a message withorg.apache.log4j.Priority.DEBUG
. -
info
Logs a message withorg.apache.log4j.Priority.INFO
. -
info
Logs a message withorg.apache.log4j.Priority.INFO
. -
warn
Logs a message withorg.apache.log4j.Priority.WARN
. -
warn
Logs a message withorg.apache.log4j.Priority.WARN
. -
error
Logs a message withorg.apache.log4j.Priority.ERROR
. -
error
Logs a message withorg.apache.log4j.Priority.ERROR
. -
fatal
Logs a message withorg.apache.log4j.Priority.FATAL
. -
fatal
Logs a message withorg.apache.log4j.Priority.FATAL
. -
getLogger
public org.apache.log4j.Logger getLogger()Return the native Logger instance we are using. -
isDebugEnabled
public boolean isDebugEnabled()Check whether the Log4j Logger used is enabled forDEBUG
priority.- Specified by:
isDebugEnabled
in interfaceLog
- Returns:
- true if debug is enabled in the underlying logger.
-
isErrorEnabled
public boolean isErrorEnabled()Check whether the Log4j Logger used is enabled forERROR
priority.- Specified by:
isErrorEnabled
in interfaceLog
- Returns:
- true if error is enabled in the underlying logger.
-
isFatalEnabled
public boolean isFatalEnabled()Check whether the Log4j Logger used is enabled forFATAL
priority.- Specified by:
isFatalEnabled
in interfaceLog
- Returns:
- true if fatal is enabled in the underlying logger.
-
isInfoEnabled
public boolean isInfoEnabled()Check whether the Log4j Logger used is enabled forINFO
priority.- Specified by:
isInfoEnabled
in interfaceLog
- Returns:
- true if info is enabled in the underlying logger.
-
isTraceEnabled
public boolean isTraceEnabled()Check whether the Log4j Logger used is enabled forTRACE
priority. When using a log4j version that does not support the TRACE level, this call will report whetherDEBUG
is enabled or not.- Specified by:
isTraceEnabled
in interfaceLog
- Returns:
- true if trace is enabled in the underlying logger.
-
isWarnEnabled
public boolean isWarnEnabled()Check whether the Log4j Logger used is enabled forWARN
priority.- Specified by:
isWarnEnabled
in interfaceLog
- Returns:
- true if warn is enabled in the underlying logger.
-