Package org.apache.commons.logging.impl
Class AvalonLogger
- java.lang.Object
-
- org.apache.commons.logging.impl.AvalonLogger
-
- All Implemented Interfaces:
Log
public class AvalonLogger extends java.lang.Object implements Log
Implementation of commons-logging Log interface that delegates all logging calls to the Avalon logging abstraction: the Logger interface.There are two ways in which this class can be used:
- the instance can be constructed with an Avalon logger
(by calling
AvalonLogger(Logger)). In this case, it acts as a simple thin wrapping implementation over the logger. This is particularly useful when using a property setter. - the
setDefaultLogger(org.apache.avalon.framework.logger.Logger)class property can be called which sets the ancestral Avalon logger for this class. AnyAvalonLoggerinstances created through theLogFactorymechanisms will output to child loggers of thisLogger.
Note:
AvalonLoggerdoes not implement Serializable because the constructors available for it make this impossible to achieve in all circumstances; there is no way to "reconnect" to an underlying Logger object on deserialization if one was just passed in to the constructor of the original object. This class was marked Serializable in the 1.0.4 release of commons-logging, but this never actually worked (a NullPointerException would be thrown as soon as the deserialized object was used), so removing this marker is not considered to be an incompatible change.- Version:
- $Id: AvalonLogger.java 1435115 2013-01-18 12:40:19Z tn $
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.avalon.framework.logger.LoggerdefaultLoggerAncestral Avalon logger.private org.apache.avalon.framework.logger.LoggerloggerAvalon logger used to perform log.
-
Constructor Summary
Constructors Constructor Description AvalonLogger(java.lang.String name)Constructs anAvalonLoggerthat will log to a child of theLoggerset by callingsetDefaultLogger(org.apache.avalon.framework.logger.Logger).AvalonLogger(org.apache.avalon.framework.logger.Logger logger)Constructs anAvalonLoggerthat outputs to the givenLoggerinstance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddebug(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.voiddebug(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.voiderror(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.error.voiderror(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.error.voidfatal(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.fatalError.voidfatal(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.fatalError.org.apache.avalon.framework.logger.LoggergetLogger()Gets the Avalon logger implementation used to perform logging.voidinfo(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.info.voidinfo(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.info.booleanisDebugEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.debugenabled?booleanisErrorEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.errorenabled?booleanisFatalEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.fatalErrorenabled?booleanisInfoEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.infoenabled?booleanisTraceEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.debugenabled?booleanisWarnEnabled()Is logging toorg.apache.avalon.framework.logger.Logger.warnenabled?static voidsetDefaultLogger(org.apache.avalon.framework.logger.Logger logger)Sets the ancestral Avalon logger from which the delegating loggers will descend.voidtrace(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.voidtrace(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.voidwarn(java.lang.Object message)Logs a message withorg.apache.avalon.framework.logger.Logger.warn.voidwarn(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.warn.
-
-
-
Constructor Detail
-
AvalonLogger
public AvalonLogger(org.apache.avalon.framework.logger.Logger logger)
Constructs anAvalonLoggerthat outputs to the givenLoggerinstance.- Parameters:
logger- the Avalon logger implementation to delegate to
-
AvalonLogger
public AvalonLogger(java.lang.String name)
Constructs anAvalonLoggerthat will log to a child of theLoggerset by callingsetDefaultLogger(org.apache.avalon.framework.logger.Logger).- Parameters:
name- the name of the avalon logger implementation to delegate to
-
-
Method Detail
-
getLogger
public org.apache.avalon.framework.logger.Logger getLogger()
Gets the Avalon logger implementation used to perform logging.- Returns:
- avalon logger implementation
-
setDefaultLogger
public static void setDefaultLogger(org.apache.avalon.framework.logger.Logger logger)
Sets the ancestral Avalon logger from which the delegating loggers will descend.- Parameters:
logger- the default avalon logger, in case there is no logger instance supplied in constructor
-
debug
public void debug(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.- Specified by:
debugin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.debug(Object, Throwable)
-
debug
public void debug(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.debug.- Specified by:
debugin interfaceLog- Parameters:
message- to log.- See Also:
Log.debug(Object)
-
error
public void error(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.error.- Specified by:
errorin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.error(Object, Throwable)
-
error
public void error(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.error.- Specified by:
errorin interfaceLog- Parameters:
message- to log- See Also:
Log.error(Object)
-
fatal
public void fatal(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.fatalError.- Specified by:
fatalin interfaceLog- Parameters:
message- to log.t- log this cause.- See Also:
Log.fatal(Object, Throwable)
-
fatal
public void fatal(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.fatalError.- Specified by:
fatalin interfaceLog- Parameters:
message- to log- See Also:
Log.fatal(Object)
-
info
public void info(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.info.- Specified by:
infoin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.info(Object, Throwable)
-
info
public void info(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.info.- Specified by:
infoin interfaceLog- Parameters:
message- to log- See Also:
Log.info(Object)
-
isDebugEnabled
public boolean isDebugEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.debugenabled?- Specified by:
isDebugEnabledin interfaceLog- Returns:
- true if debug is enabled in the underlying logger.
- See Also:
Log.isDebugEnabled()
-
isErrorEnabled
public boolean isErrorEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.errorenabled?- Specified by:
isErrorEnabledin interfaceLog- Returns:
- true if error is enabled in the underlying logger.
- See Also:
Log.isErrorEnabled()
-
isFatalEnabled
public boolean isFatalEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.fatalErrorenabled?- Specified by:
isFatalEnabledin interfaceLog- Returns:
- true if fatal is enabled in the underlying logger.
- See Also:
Log.isFatalEnabled()
-
isInfoEnabled
public boolean isInfoEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.infoenabled?- Specified by:
isInfoEnabledin interfaceLog- Returns:
- true if info is enabled in the underlying logger.
- See Also:
Log.isInfoEnabled()
-
isTraceEnabled
public boolean isTraceEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.debugenabled?- Specified by:
isTraceEnabledin interfaceLog- Returns:
- true if trace is enabled in the underlying logger.
- See Also:
Log.isTraceEnabled()
-
isWarnEnabled
public boolean isWarnEnabled()
Is logging toorg.apache.avalon.framework.logger.Logger.warnenabled?- Specified by:
isWarnEnabledin interfaceLog- Returns:
- true if warn is enabled in the underlying logger.
- See Also:
Log.isWarnEnabled()
-
trace
public void trace(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.debug.- Specified by:
tracein interfaceLog- Parameters:
message- to log.t- log this cause.- See Also:
Log.trace(Object, Throwable)
-
trace
public void trace(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.debug.- Specified by:
tracein interfaceLog- Parameters:
message- to log- See Also:
Log.trace(Object)
-
warn
public void warn(java.lang.Object message, java.lang.Throwable t)Logs a message withorg.apache.avalon.framework.logger.Logger.warn.- Specified by:
warnin interfaceLog- Parameters:
message- to logt- log this cause- See Also:
Log.warn(Object, Throwable)
-
warn
public void warn(java.lang.Object message)
Logs a message withorg.apache.avalon.framework.logger.Logger.warn.- Specified by:
warnin interfaceLog- Parameters:
message- to log- See Also:
Log.warn(Object)
-
-