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

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

public class PrefixDecorator
extends LoggerManagerDecorator
implements LoggerManager

This class implements LoggerManager interface by prepending a prefix to all requests and letting the wrapped LoggerManager actually create the loggers.

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
PrefixDecorator(LoggerManager loggerManager, java.lang.String prefix)
          Creates a PrefixDecorator 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

PrefixDecorator

public PrefixDecorator(LoggerManager loggerManager,
                       java.lang.String prefix)
Creates a PrefixDecorator instance.

Parameters:
prefix - the prefix to prepend; can be neither null nor empty. This is done to avoid ambiguity in the getDefaultLogger() method - what would we call in such case getDefaultLogger() or getLoggerForCategory("") ?
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. This is basically the same as getting the Logger for the "" category.

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


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