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

java.lang.Object
  extended by org.apache.avalon.excalibur.logger.decorator.LoggerManagerDecorator
      extended by org.apache.avalon.excalibur.logger.decorator.PrefixDecorator
All Implemented Interfaces:
LoggerManager, org.apache.avalon.framework.activity.Disposable, org.apache.avalon.framework.activity.Startable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.context.Contextualizable, org.apache.avalon.framework.logger.LogEnabled

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
private  java.lang.String m_prefix
           
 
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
 org.apache.avalon.framework.logger.Logger getDefaultLogger()
          Return the default Logger.
 org.apache.avalon.framework.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
 

Field Detail

m_prefix

private final java.lang.String m_prefix
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 org.apache.avalon.framework.logger.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 org.apache.avalon.framework.logger.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