org.apache.avalon.excalibur.logger
Class SimpleLogKitManager

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.avalon.excalibur.logger.SimpleLogKitManager
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

public class SimpleLogKitManager
extends org.apache.avalon.framework.logger.AbstractLogEnabled
implements LoggerManager, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.activity.Disposable

A LoggerManager that supports the old <logs version="1.0"/> style logging configuration from Phoenix.

Author:
Avalon Development Team

Field Summary
private static java.lang.String DEFAULT_FORMAT
           
private  java.io.File m_baseDirectory
           
private  org.apache.log.Hierarchy m_hierarchy
          Hierarchy of Application logging
private  org.apache.avalon.framework.logger.Logger m_logger
          The root logger wrapped using AValons Logging Facade.
private  org.apache.log.Logger m_logkitLogger
          The root logger in hierarchy.
private  java.util.Collection m_targets
           
 
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
ROLE
 
Constructor Summary
SimpleLogKitManager()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Interpret configuration to build loggers.
private  void configureCategories(org.apache.avalon.framework.configuration.Configuration[] categories, java.util.HashMap targets)
          Configure Logging categories.
private  java.util.HashMap configureTargets(org.apache.avalon.framework.configuration.Configuration[] targets)
          Configure a set of logtargets based on config data.
 void contextualize(org.apache.avalon.framework.context.Context context)
          Contextualize the manager.
 void dispose()
          Close any closable log targets opened by LoggerManager.
 org.apache.avalon.framework.logger.Logger getDefaultLogger()
          Retrieve the root logger.
 org.apache.avalon.framework.logger.Logger getLoggerForCategory(java.lang.String name)
          Retrieve a logger by name.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FORMAT

private static final java.lang.String DEFAULT_FORMAT
See Also:
Constant Field Values

m_baseDirectory

private java.io.File m_baseDirectory

m_hierarchy

private final org.apache.log.Hierarchy m_hierarchy
Hierarchy of Application logging


m_logkitLogger

private final org.apache.log.Logger m_logkitLogger
The root logger in hierarchy.


m_logger

private org.apache.avalon.framework.logger.Logger m_logger
The root logger wrapped using AValons Logging Facade.


m_targets

private java.util.Collection m_targets
Constructor Detail

SimpleLogKitManager

public SimpleLogKitManager()
Method Detail

contextualize

public void contextualize(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Contextualize the manager. Requires that the "app.home" entry be set to a File object that points at the base directory for logs.

Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Parameters:
context - the context
Throws:
org.apache.avalon.framework.context.ContextException - if missing context entry

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Interpret configuration to build loggers.

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

dispose

public void dispose()
Close any closable log targets opened by LoggerManager.

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

getLoggerForCategory

public org.apache.avalon.framework.logger.Logger getLoggerForCategory(java.lang.String name)
Retrieve a logger by name.

Specified by:
getLoggerForCategory in interface LoggerManager
Parameters:
name - the name of logger
Returns:
the specified Logger

getDefaultLogger

public org.apache.avalon.framework.logger.Logger getDefaultLogger()
Retrieve the root logger.

Specified by:
getDefaultLogger in interface LoggerManager
Returns:
the root Logger

configureTargets

private java.util.HashMap configureTargets(org.apache.avalon.framework.configuration.Configuration[] targets)
                                    throws org.apache.avalon.framework.configuration.ConfigurationException
Configure a set of logtargets based on config data.

Parameters:
targets - the target configuration data
Returns:
a Map of target-name to target
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs

configureCategories

private void configureCategories(org.apache.avalon.framework.configuration.Configuration[] categories,
                                 java.util.HashMap targets)
                          throws org.apache.avalon.framework.configuration.ConfigurationException
Configure Logging categories.

Parameters:
categories - configuration data for categories
targets - a hashmap containing the already existing taregt
Throws:
org.apache.avalon.framework.configuration.ConfigurationException - if an error occurs