org.apache.avalon.excalibur.logger
Class DefaultLoggerManager

java.lang.Object
  extended by org.apache.avalon.excalibur.logger.DefaultLoggerManager
All Implemented Interfaces:
LoggerManager, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.thread.ThreadSafe

public final class DefaultLoggerManager
extends java.lang.Object
implements LoggerManager, org.apache.avalon.framework.thread.ThreadSafe, org.apache.avalon.framework.logger.LogEnabled, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.activity.Disposable

This logger manager is a wrapper around all other "real" logger managers. The idea is to have one single configuration file where you can define, which logger manager (Log4J, LogKit etc.) you want to use, so you don't have to hard-code this.

Version:
CVS $Revision: 1.9 $ $Date: 2004/03/10 13:54:49 $
Author:
Avalon Development Team

Field Summary
private  org.apache.avalon.framework.context.Context m_context
          The context object
private  boolean m_disposeManager
          Do we have to dispose the manager
private  org.apache.avalon.framework.logger.Logger m_logger
          The logger used to log output from the logger manager.
private  LoggerManager m_loggermanager
          The used LoggerManager
private  org.apache.avalon.framework.service.ServiceManager m_manager
          The service manager
private  java.lang.String m_prefix
          The prefix
 
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
ROLE
 
Constructor Summary
DefaultLoggerManager()
          Creates a new DefaultLoggerManager.
DefaultLoggerManager(java.lang.String prefix)
          Creates a new DefaultLoggerManager.
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Reads a configuration object and creates the category mapping.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Reads a context object that will be supplied to the logger manager.
 void dispose()
           
 void enableLogging(org.apache.avalon.framework.logger.Logger logger)
          Provide a logger.
 org.apache.avalon.framework.logger.Logger getDefaultLogger()
          Return the default Logger.
 org.apache.avalon.framework.logger.Logger getLoggerForCategory(java.lang.String categoryName)
          Return the Logger for the specified category.
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_loggermanager

private LoggerManager m_loggermanager
The used LoggerManager


m_context

private org.apache.avalon.framework.context.Context m_context
The context object


m_logger

private org.apache.avalon.framework.logger.Logger m_logger
The logger used to log output from the logger manager.


m_prefix

private java.lang.String m_prefix
The prefix


m_manager

private org.apache.avalon.framework.service.ServiceManager m_manager
The service manager


m_disposeManager

private boolean m_disposeManager
Do we have to dispose the manager

Constructor Detail

DefaultLoggerManager

public DefaultLoggerManager()
Creates a new DefaultLoggerManager. .


DefaultLoggerManager

public DefaultLoggerManager(java.lang.String prefix)
Creates a new DefaultLoggerManager. .

Method Detail

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger logger)
Provide a logger.

Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled
Parameters:
logger - the logger

getLoggerForCategory

public final org.apache.avalon.framework.logger.Logger getLoggerForCategory(java.lang.String categoryName)
Return the Logger for the specified category.

Specified by:
getLoggerForCategory in interface LoggerManager

getDefaultLogger

public final org.apache.avalon.framework.logger.Logger getDefaultLogger()
Return the default Logger. This is basically the same as getting the Logger for the "" category.

Specified by:
getDefaultLogger in interface LoggerManager

contextualize

public final void contextualize(org.apache.avalon.framework.context.Context context)
                         throws org.apache.avalon.framework.context.ContextException
Reads a context object that will be supplied to the logger manager.

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Parameters:
context - The context object.
Throws:
org.apache.avalon.framework.context.ContextException - if the context is malformed

configure

public final void configure(org.apache.avalon.framework.configuration.Configuration configuration)
                     throws org.apache.avalon.framework.configuration.ConfigurationException
Reads a configuration object and creates the category mapping.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - The configuration object.
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if the configuration is malformed

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException

dispose

public void dispose()
Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable