Package org.apache.commons.logging.impl
Class Log4JLogger
- java.lang.Object
-
- org.apache.commons.logging.impl.Log4JLogger
-
- All Implemented Interfaces:
java.io.Serializable,Log
public class Log4JLogger extends java.lang.Object implements Log, java.io.Serializable
Implementation ofLogthat 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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringFQCNThe fully qualified name of the Log4JLogger class.private org.apache.log4j.LoggerloggerLog to this loggerprivate java.lang.StringnameLogger nameprivate static longserialVersionUIDSerializable version identifier.private static org.apache.log4j.PrioritytraceLevel
-
Constructor Summary
Constructors Constructor Description Log4JLogger()Log4JLogger(java.lang.String name)Base constructor.Log4JLogger(org.apache.log4j.Logger logger)For use with a log4j factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.DEBUG.voiddebug(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.DEBUG.voiderror(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.ERROR.voiderror(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.ERROR.voidfatal(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.FATAL.voidfatal(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.FATAL.org.apache.log4j.LoggergetLogger()Return the native Logger instance we are using.voidinfo(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.INFO.voidinfo(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.INFO.booleanisDebugEnabled()Check whether the Log4j Logger used is enabled forDEBUGpriority.booleanisErrorEnabled()Check whether the Log4j Logger used is enabled forERRORpriority.booleanisFatalEnabled()Check whether the Log4j Logger used is enabled forFATALpriority.booleanisInfoEnabled()Check whether the Log4j Logger used is enabled forINFOpriority.booleanisTraceEnabled()Check whether the Log4j Logger used is enabled forTRACEpriority.booleanisWarnEnabled()Check whether the Log4j Logger used is enabled forWARNpriority.voidtrace(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.TRACE.voidtrace(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.TRACE.voidwarn(java.lang.Object message)Logs a message withorg.apache.log4j.Priority.WARN.voidwarn(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.WARN.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serializable version identifier.- See Also:
- Constant Field Values
-
FQCN
private static final java.lang.String FQCN
The fully qualified name of the Log4JLogger class.
-
logger
private transient volatile org.apache.log4j.Logger logger
Log to this logger
-
name
private final java.lang.String name
Logger name
-
traceLevel
private static final org.apache.log4j.Priority traceLevel
-
-
Method Detail
-
trace
public void trace(java.lang.Object message)
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.- Specified by:
tracein interfaceLog- Parameters:
message- to log- See Also:
Log.trace(Object)
-
trace
public void trace(java.lang.Object message, java.lang.Throwable t)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.- Specified by:
tracein interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.trace(Object, Throwable)
-
debug
public void debug(java.lang.Object message)
Logs a message withorg.apache.log4j.Priority.DEBUG.- Specified by:
debugin interfaceLog- Parameters:
message- to log- See Also:
Log.debug(Object)
-
debug
public void debug(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.DEBUG.- Specified by:
debugin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.debug(Object, Throwable)
-
info
public void info(java.lang.Object message)
Logs a message withorg.apache.log4j.Priority.INFO.- Specified by:
infoin interfaceLog- Parameters:
message- to log- See Also:
Log.info(Object)
-
info
public void info(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.INFO.- Specified by:
infoin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.info(Object, Throwable)
-
warn
public void warn(java.lang.Object message)
Logs a message withorg.apache.log4j.Priority.WARN.- Specified by:
warnin interfaceLog- Parameters:
message- to log- See Also:
Log.warn(Object)
-
warn
public void warn(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.WARN.- Specified by:
warnin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.warn(Object, Throwable)
-
error
public void error(java.lang.Object message)
Logs a message withorg.apache.log4j.Priority.ERROR.- Specified by:
errorin interfaceLog- Parameters:
message- to log- See Also:
Log.error(Object)
-
error
public void error(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.ERROR.- Specified by:
errorin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.error(Object, Throwable)
-
fatal
public void fatal(java.lang.Object message)
Logs a message withorg.apache.log4j.Priority.FATAL.- Specified by:
fatalin interfaceLog- Parameters:
message- to log- See Also:
Log.fatal(Object)
-
fatal
public void fatal(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.log4j.Priority.FATAL.- Specified by:
fatalin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.fatal(Object, Throwable)
-
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.
-
-