org.apache.avalon.excalibur.logger.util
Class LoggerSwitch

java.lang.Object
  extended byorg.apache.avalon.excalibur.logger.util.LoggerSwitch

public class LoggerSwitch
extends java.lang.Object

A proxy logger that switches between two underlying loggers with recursive invocation detection.

This class is intended to be used by o.a.a.e.logger.AbstractLoggerManager. all the logger switching is done in it during the "warm-up" phase (constructor, enableLogging, contextualize, configure, start). All these operations are held our on a single thread and the object is not exposed to other threads untill (in strict synchronization sense) it has been fully configured. That's why there is no synchronization in this class. If the switching was to occur in a mulitythreaded fasion we would have to synchronize access to m_fallback and m_preferred.

Author:
Avalon Development Team

Field Summary
protected static Logger SHARED_NULL
           
 
Constructor Summary
LoggerSwitch(Logger fallback)
           
LoggerSwitch(Logger fallback, Logger preferred)
           
 
Method Summary
 Logger get()
          We create a logger with no methods for changing m_fallback and m_preferred for security reasons.
 void setFallback(Logger fallback)
           
 void setPreferred(Logger preferred)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHARED_NULL

protected static final Logger SHARED_NULL
Constructor Detail

LoggerSwitch

public LoggerSwitch(Logger fallback)

LoggerSwitch

public LoggerSwitch(Logger fallback,
                    Logger preferred)
Method Detail

get

public Logger get()
We create a logger with no methods for changing m_fallback and m_preferred for security reasons. All the control is done by the parent class that does not implement Logger itself.


setFallback

public void setFallback(Logger fallback)

setPreferred

public void setPreferred(Logger preferred)


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