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

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

public class Log4JConfAdapter
extends Log4JAdapter
implements org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.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
private  org.apache.avalon.framework.context.Context m_context
           
 
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(org.apache.avalon.framework.configuration.Configuration configuration)
          Feed our configuration to Log4J.
 void contextualize(org.apache.avalon.framework.context.Context context)
           
 
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
 

Field Detail

m_context

private org.apache.avalon.framework.context.Context m_context
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(org.apache.avalon.framework.context.Context context)
                   throws org.apache.avalon.framework.context.ContextException
Specified by:
contextualize in interface org.apache.avalon.framework.context.Contextualizable
Throws:
org.apache.avalon.framework.context.ContextException

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Feed our configuration to Log4J.

Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException