public class

AvalonLogger

extends Object
implements Log
java.lang.Object
   ↳ org.apache.commons.logging.impl.AvalonLogger

Class Overview

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(Logger) class property can be called which sets the ancesteral Avalon logger for this class. Any AvalonLogger instances created through the LogFactory mechanisms will output to child loggers of this Logger.

Note: AvalonLogger does 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.

Summary

Public Constructors
AvalonLogger(Logger logger)
Constructs an AvalonLogger that outputs to the given Logger instance.
AvalonLogger(String name)
Constructs an AvalonLogger that will log to a child of the Logger set by calling setDefaultLogger(Logger).
Public Methods
void debug(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
void debug(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
void error(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.error.
void error(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.error.
void fatal(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.
void fatal(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.
Logger getLogger()
Gets the Avalon logger implementation used to perform logging.
void info(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.info.
void info(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.info.
boolean isDebugEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?
boolean isErrorEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.error enabled?
boolean isFatalEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.fatalError enabled?
boolean isInfoEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.info enabled?
boolean isTraceEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?
boolean isWarnEnabled()
Is logging to org.apache.avalon.framework.logger.Logger.warn enabled?
static void setDefaultLogger(Logger logger)
Sets the ancesteral Avalon logger from which the delegating loggers will descend.
void trace(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
void trace(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.debug.
void warn(Object message, Throwable t)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.
void warn(Object message)
Logs a message with org.apache.avalon.framework.logger.Logger.warn.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.commons.logging.Log

Public Constructors

public AvalonLogger (Logger logger)

Constructs an AvalonLogger that outputs to the given Logger instance.

Parameters
logger the avalon logger implementation to delegate to

public AvalonLogger (String name)

Constructs an AvalonLogger that will log to a child of the Logger set by calling setDefaultLogger(Logger).

Parameters
name the name of the avalon logger implementation to delegate to

Public Methods

public void debug (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters
message to log
t log this cause

public void debug (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters
message to log.
See Also

public void error (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.error.

Parameters
message to log
See Also

public void error (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.error.

Parameters
message to log
t log this cause

public void fatal (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.

Parameters
message to log
See Also

public void fatal (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.fatalError.

Parameters
message to log.
t log this cause.

public Logger getLogger ()

Gets the Avalon logger implementation used to perform logging.

Returns
  • avalon logger implementation

public void info (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.info.

Parameters
message to log
See Also

public void info (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.info.

Parameters
message to log
t log this cause

public boolean isDebugEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?

Returns
  • true if debug is enabled in the underlying logger.
See Also

public boolean isErrorEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.error enabled?

Returns
  • true if error is enabled in the underlying logger.
See Also

public boolean isFatalEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.fatalError enabled?

Returns
  • true if fatal is enabled in the underlying logger.
See Also

public boolean isInfoEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.info enabled?

Returns
  • true if info is enabled in the underlying logger.
See Also

public boolean isTraceEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.debug enabled?

Returns
  • true if trace is enabled in the underlying logger.
See Also

public boolean isWarnEnabled ()

Is logging to org.apache.avalon.framework.logger.Logger.warn enabled?

Returns
  • true if warn is enabled in the underlying logger.
See Also

public static void setDefaultLogger (Logger logger)

Sets the ancesteral 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

public void trace (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters
message to log
See Also

public void trace (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.debug.

Parameters
message to log.
t log this cause.

public void warn (Object message, Throwable t)

Logs a message with org.apache.avalon.framework.logger.Logger.warn.

Parameters
message to log
t log this cause

public void warn (Object message)

Logs a message with org.apache.avalon.framework.logger.Logger.warn.

Parameters
message to log
See Also