org.apache.avalon.excalibur.logger.log4j
Class Log4JConfAdapter

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.avalon.excalibur.logger.log4j.Log4JAdapter
          extended byorg.apache.avalon.excalibur.logger.log4j.Log4JConfAdapter
All Implemented Interfaces:
Configurable, Contextualizable, LogEnabled, LoggerManager

public class Log4JConfAdapter
extends Log4JAdapter
implements Configurable, Contextualizable

A LoggerManager for Log4j that will configure the Log4j subsystem using specified configuration.

Note that in case of logging errors Log4J will (via the org.apache.log4j.helpers.LogLog class) write to System.err. This can be switched off but we can not substitute our own handler to log erros the way we prefer to do this. :-(

So, unlike the LogKit case we have no Log4JLogger helper to implement and hence a different architecture: this class is not a helper but a regular subclass of Log4JAdapter.

Attach PrefixDecorator and/or CachingDecorator if desired.

Since:
4.0
Version:
CVS $Revision: 1.4 $ $Date: 2004/03/10 13:54:51 $
Author:
Avalon Development Team

Field Summary
 
Fields inherited from class org.apache.avalon.excalibur.logger.log4j.Log4JAdapter
m_hierarchy
 
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
ROLE
 
Constructor Summary
Log4JConfAdapter()
          This constructor creates a completely independent Log4J hierarchy.
 
Method Summary
 void configure(Configuration configuration)
          Feed our configuration to Log4J.
 void contextualize(Context context)
          Pass the Context to the component.
 
Methods inherited from class org.apache.avalon.excalibur.logger.log4j.Log4JAdapter
getDefaultLogger, getLoggerForCategory
 
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
 

Constructor Detail

Log4JConfAdapter

public Log4JConfAdapter()
This constructor creates a completely independent Log4J hierarchy. If you want to log to an existing Log4J hierarchy please use Log4JAdapter. This class always creates a new private hierarchy and configures it all by itself.

Method Detail

contextualize

public void contextualize(Context context)
                   throws ContextException
Description copied from interface: Contextualizable
Pass the Context to the component. This method is called after the LogEnabled.enableLogging( Logger ) (if present) method and before any other method.

Specified by:
contextualize in interface Contextualizable
Parameters:
context - the context. Must not be null.
Throws:
ContextException - if context is invalid

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Feed our configuration to Log4J.

Specified by:
configure in interface Configurable
Parameters:
configuration - the class configurations. Must not be null.
Throws:
ConfigurationException - if an error occurs


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