org.apache.avalon.excalibur.logger.decorator
Class CachingDecorator

java.lang.Object
  extended byorg.apache.avalon.excalibur.logger.decorator.LoggerManagerDecorator
      extended byorg.apache.avalon.excalibur.logger.decorator.CachingDecorator
All Implemented Interfaces:
Configurable, Contextualizable, Disposable, LogEnabled, LoggerManager, Startable

public class CachingDecorator
extends LoggerManagerDecorator

This class implements LoggerManager interface by passing all the job to a wrapped LoggerManager, but the returened Loggers are cached. All operations of this class are synchronized via a single lock. As the LoggerManager is not expected to be a performance bottleneck probably this design will be good enough.

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

Field Summary
 
Fields inherited from class org.apache.avalon.excalibur.logger.decorator.LoggerManagerDecorator
m_loggerManager
 
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager
ROLE
 
Constructor Summary
CachingDecorator(LoggerManager loggerManager)
          Creates a CachingDecorator instance.
 
Method Summary
 Logger getDefaultLogger()
          Return the default Logger.
 Logger getLoggerForCategory(java.lang.String categoryName)
          Return the Logger for the specified category.
 
Methods inherited from class org.apache.avalon.excalibur.logger.decorator.LoggerManagerDecorator
configure, contextualize, dispose, enableLogging, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CachingDecorator

public CachingDecorator(LoggerManager loggerManager)
Creates a CachingDecorator instance.

Method Detail

getLoggerForCategory

public Logger getLoggerForCategory(java.lang.String categoryName)
Return the Logger for the specified category.

Specified by:
getLoggerForCategory in interface LoggerManager
Overrides:
getLoggerForCategory in class LoggerManagerDecorator

getDefaultLogger

public Logger getDefaultLogger()
Return the default Logger. Although it is expected that the wrapped loggerManager will return the same as getLoggerForCategory("") we cache the value separtely.

Specified by:
getDefaultLogger in interface LoggerManager
Overrides:
getDefaultLogger in class LoggerManagerDecorator


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