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 StringThe fully qualified name of the Log4JLogger class.private org.apache.log4j.LoggerLog to this loggerprivate final StringLogger nameprivate static final longSerializable 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 TypeMethodDescriptionvoidLogs a message withorg.apache.log4j.Priority.DEBUG.voidLogs a message withorg.apache.log4j.Priority.DEBUG.voidLogs a message withorg.apache.log4j.Priority.ERROR.voidLogs a message withorg.apache.log4j.Priority.ERROR.voidLogs a message withorg.apache.log4j.Priority.FATAL.voidLogs a message withorg.apache.log4j.Priority.FATAL.org.apache.log4j.LoggerReturn the native Logger instance we are using.voidLogs a message withorg.apache.log4j.Priority.INFO.voidLogs a message withorg.apache.log4j.Priority.INFO.booleanCheck whether the Log4j Logger used is enabled forDEBUGpriority.booleanCheck whether the Log4j Logger used is enabled forERRORpriority.booleanCheck whether the Log4j Logger used is enabled forFATALpriority.booleanCheck whether the Log4j Logger used is enabled forINFOpriority.booleanCheck whether the Log4j Logger used is enabled forTRACEpriority.booleanCheck whether the Log4j Logger used is enabled forWARNpriority.voidLogs a message withorg.apache.log4j.Priority.TRACE.voidLogs a message withorg.apache.log4j.Priority.TRACE.voidLogs a message withorg.apache.log4j.Priority.WARN.voidLogs 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 theTRACElevel, the message will be logged at theDEBUGlevel. -
trace
Logs a message withorg.apache.log4j.Priority.TRACE. When using a log4j version that does not support theTRACElevel, the message will be logged at theDEBUGlevel. -
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 forDEBUGpriority.- Specified by:
isDebugEnabledin interfaceLog- Returns:
- true if debug is enabled in the underlying logger.
-
isErrorEnabled
public boolean isErrorEnabled()Check whether the Log4j Logger used is enabled forERRORpriority.- Specified by:
isErrorEnabledin interfaceLog- Returns:
- true if error is enabled in the underlying logger.
-
isFatalEnabled
public boolean isFatalEnabled()Check whether the Log4j Logger used is enabled forFATALpriority.- Specified by:
isFatalEnabledin interfaceLog- Returns:
- true if fatal is enabled in the underlying logger.
-
isInfoEnabled
public boolean isInfoEnabled()Check whether the Log4j Logger used is enabled forINFOpriority.- Specified by:
isInfoEnabledin interfaceLog- Returns:
- true if info is enabled in the underlying logger.
-
isTraceEnabled
public boolean isTraceEnabled()Check whether the Log4j Logger used is enabled forTRACEpriority. When using a log4j version that does not support the TRACE level, this call will report whetherDEBUGis enabled or not.- Specified by:
isTraceEnabledin interfaceLog- Returns:
- true if trace is enabled in the underlying logger.
-
isWarnEnabled
public boolean isWarnEnabled()Check whether the Log4j Logger used is enabled forWARNpriority.- Specified by:
isWarnEnabledin interfaceLog- Returns:
- true if warn is enabled in the underlying logger.
-