org.apache.avalon.excalibur.logger
Class DefaultLoggerManager

java.lang.Object
  extended byorg.apache.avalon.excalibur.logger.DefaultLoggerManager
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, LogEnabled, LoggerManager, Serviceable, ThreadSafe

public final class DefaultLoggerManager
extends java.lang.Object
implements LoggerManager, ThreadSafe, LogEnabled, Contextualizable, Configurable, Serviceable, 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
 
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(Configuration configuration)
          Reads a configuration object and creates the category mapping.
 void contextualize(Context context)
          Reads a context object that will be supplied to the logger manager.
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 void enableLogging(Logger logger)
          Provide a logger.
 Logger getDefaultLogger()
          Return the default Logger.
 Logger getLoggerForCategory(java.lang.String categoryName)
          Return the Logger for the specified category.
 void service(ServiceManager manager)
          Pass the ServiceManager to the Serviceable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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(Logger logger)
Provide a logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger - the logger

getLoggerForCategory

public final Logger getLoggerForCategory(java.lang.String categoryName)
Return the Logger for the specified category.

Specified by:
getLoggerForCategory in interface LoggerManager

getDefaultLogger

public final 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(Context context)
                         throws ContextException
Reads a context object that will be supplied to the logger manager.

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

configure

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

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

service

public void service(ServiceManager manager)
             throws ServiceException
Description copied from interface: Serviceable
Pass the ServiceManager to the Serviceable. The Serviceable implementation should use the specified ServiceManager to acquire the components it needs for execution.

Specified by:
service in interface Serviceable
Parameters:
manager - The ServiceManager which this Serviceable uses. Must not be null.
Throws:
ServiceException - if an error occurs

dispose

public void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.

Specified by:
dispose in interface Disposable


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.