|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.avalon.excalibur.logger.AbstractLoggerManager
This abstract class implements LogEnabled.
A derived class is expected to obtain a logger via
getLogger()
and live with it.
The Logger
supplied via enableLogging
will be used both as the "initial" and as the "fallback" logger.
start()
the messages logger via
getLogger().xxx()
will go to this loggerstart
a recursive invocation of getLogger().xxx()
will be detected
the message will be logged via the initial logger as a fallback.LoggerSwitch
for
more details.
Field Summary | |
protected java.util.Map |
m_loggers
Map for name to logger mapping. |
protected java.lang.String |
m_prefix
The root logger to configure |
Fields inherited from interface org.apache.avalon.excalibur.logger.LoggerManager |
ROLE |
Constructor Summary | |
AbstractLoggerManager(java.lang.String prefix,
java.lang.String switchTo,
Logger defaultLoggerOverride)
Initializes AbstractLoggerManager. |
Method Summary | |
protected abstract Logger |
doGetLoggerForCategory(java.lang.String fullCategoryName)
Actually create a logger wrapping underlying logger backed implementation for a give category. |
void |
enableLogging(Logger fallbackLogger)
Accept the logger we shall use as the initial and the fallback logger. |
Logger |
getDefaultLogger()
Retruns the logger for the "" category. |
protected Logger |
getLogger()
Derived LoggerManager implementations should obtain a logger to log their own messages via this call. |
Logger |
getLoggerForCategory(java.lang.String categoryName)
Retrieves a Logger from a category name. |
void |
start()
Get a logger from ourselves and pass it to m_switch . |
void |
stop()
Startable.stop() empty implementation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final java.util.Map m_loggers
protected java.lang.String m_prefix
Constructor Detail |
public AbstractLoggerManager(java.lang.String prefix, java.lang.String switchTo, Logger defaultLoggerOverride)
prefix
- the prefix to prepended to the category name
on each invocation of getLoggerForCategory before
passing the category name on to the underlying logging
system (currently LogKit or Log4J).switchTo
- fuel for the start()
method;
if null start()
will do nothing;
if empty start()
will switch to
getLoggerForCategory("")
.Method Detail |
protected Logger getLogger()
public void enableLogging(Logger fallbackLogger)
enableLogging
in interface LogEnabled
fallbackLogger
- the logger. Must not be null
.public void start()
m_switch
.
public void stop()
public final Logger getDefaultLogger()
""
category.
getDefaultLogger
in interface LoggerManager
protected abstract Logger doGetLoggerForCategory(java.lang.String fullCategoryName)
public final Logger getLoggerForCategory(java.lang.String categoryName)
getLoggerForCategory
in interface LoggerManager
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |