Class Log4JConfAdapter

  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.

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

Field Summary
Fields inherited from class org.apache.avalon.excalibur.logger.log4j.Log4JAdapter
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
Constructor Summary
          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


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


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
context - the context. Must not be null.
ContextException - if context is invalid


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

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

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