org.apache.avalon.framework.logger
Class AbstractLogEnabled

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
All Implemented Interfaces:
LogEnabled
Direct Known Subclasses:
AbstractAccessor, AbstractContainer, AbstractCreator, AbstractDataSourceCluster, AbstractDualLogEnabled, AbstractHandlerFactory, AbstractIdGenerator, AbstractJdbcConnection, AbstractLogEnabledInstrumentable, AbstractMetaInfoManager, AbstractPool, AbstractProcessorImpl, AbstractReadWriteStore, AbstractRoleManager, AbstractService, AbstractTargetFactory, AbstractThreadManager, AbstractThreadManager, AbstractThreadManager.PipelineRunner, AbstractTLSSocketFactory, AvalonFileRepositoryMonitor, AvalonLoggerConnectionMonitor, CommandManager, CommonsVFSSourceFactory, DefaultDataSourceSelector, DefaultDOMHandlerFactory, DefaultDOMSerializer, DefaultEntityResolver, DefaultExampleInstrumentable, DefaultHelloDBService, DefaultInstrumentManagerImpl, DefaultLogKitManager, DefaultLogTargetFactoryManager, DefaultLogTargetManager, DefaultSocketManager, DefaultTimeScheduler, DefaultXMLizer, ExtendedComponentImpl, FortressCommandFailureHandler, HTTPClientSource, HTTPClientSourceFactory, InformixDataSource, InstrumentedResourceLimitingPool, InstrumentProxy, J2eeDataSource, JaxpParser, JdbcConnectionFactory, JdbcDataSource, JTidyHTMLParser, LatchedThreadGroup, LifecycleExtensionManager, Log4JAdapter, LogKitAdapter, LogKitConfHelper, MemoryStore, MRUMemoryStore, RepositoryManager, ResourceLimitingPool, ResourceSourceFactory, SimpleLogKitManager, SingleThreadedPool, SourceResolverImpl, SSLFactoryBuilder, StoreJanitorImpl, URLSourceFactory, XercesParser, XSLTProcessorImpl

public abstract class AbstractLogEnabled
extends java.lang.Object
implements LogEnabled

Utility class to allow easy construction of components that will perform logging.

Version:
$Id: AbstractLogEnabled.java 30977 2004-07-30 08:57:54Z niclas $
Author:
Avalon Development Team

Constructor Summary
AbstractLogEnabled()
           
 
Method Summary
 void enableLogging(Logger logger)
          Set the components logger.
protected  Logger getLogger()
          Helper method to allow sub-classes to aquire logger.
protected  void setupLogger(java.lang.Object component)
          Helper method to setup other components with same logger.
protected  void setupLogger(java.lang.Object component, Logger logger)
          Helper method to setup other components with logger.
protected  void setupLogger(java.lang.Object component, java.lang.String subCategory)
          Helper method to setup other components with logger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLogEnabled

public AbstractLogEnabled()
Method Detail

enableLogging

public void enableLogging(Logger logger)
Set the components logger.

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

getLogger

protected final Logger getLogger()
Helper method to allow sub-classes to aquire logger. This method exists rather than exposing a member variable because it protects other users against future changes. It also means they do not have to use our naming convention.

There is no performance penalty as this is a final method and will be inlined by the JVM.

Returns:
the Logger

setupLogger

protected void setupLogger(java.lang.Object component)
Helper method to setup other components with same logger.

Parameters:
component - the component to pass logger object to

setupLogger

protected void setupLogger(java.lang.Object component,
                           java.lang.String subCategory)
Helper method to setup other components with logger. The logger has the subcategory of this components logger.

Parameters:
component - the component to pass logger object to
subCategory - the subcategory to use (may be null)

setupLogger

protected void setupLogger(java.lang.Object component,
                           Logger logger)
Helper method to setup other components with logger.

Parameters:
component - the component to pass logger object to
logger - the Logger


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