public class LoggerSwitch
extends java.lang.Object
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.
| Modifier and Type | Class and Description |
|---|---|
private static class |
LoggerSwitch.BooleanThreadLocal |
private static class |
LoggerSwitch.SwitchingLogger |
| Modifier and Type | Field and Description |
|---|---|
private LoggerSwitch.SwitchingLogger |
m_switch |
protected static org.apache.avalon.framework.logger.Logger |
SHARED_NULL |
| Constructor and Description |
|---|
LoggerSwitch(org.apache.avalon.framework.logger.Logger fallback) |
LoggerSwitch(org.apache.avalon.framework.logger.Logger fallback,
org.apache.avalon.framework.logger.Logger preferred) |
| Modifier and Type | Method and Description |
|---|---|
org.apache.avalon.framework.logger.Logger |
get()
We create a logger with no methods for changing
m_fallback and m_preferred for security reasons.
|
void |
setFallback(org.apache.avalon.framework.logger.Logger fallback) |
void |
setPreferred(org.apache.avalon.framework.logger.Logger preferred) |
protected static final org.apache.avalon.framework.logger.Logger SHARED_NULL
private LoggerSwitch.SwitchingLogger m_switch
public LoggerSwitch(org.apache.avalon.framework.logger.Logger fallback)
public LoggerSwitch(org.apache.avalon.framework.logger.Logger fallback,
org.apache.avalon.framework.logger.Logger preferred)
public org.apache.avalon.framework.logger.Logger get()
public void setFallback(org.apache.avalon.framework.logger.Logger fallback)
public void setPreferred(org.apache.avalon.framework.logger.Logger preferred)