com.bitfactoryinc.logging
Class CompositeLogger
java.lang.Object
|
+--com.bitfactoryinc.logging.Logger
|
+--com.bitfactoryinc.logging.CompositeLogger
- public class CompositeLogger
- extends Logger
This class is just what it's name implies: a Composite Logger.
Instances contain other Loggers. When instances of this class log LogEntries,
they simply pass on the LogEntries to the Loggers contained therein.
Loggers are contained in a HashMap, with the keys being Strings.
This provides a nice means to access a specific contained Logger, if necessary.
Instances of this class are likely to be used as an application's main logger,
within which more specific loggers can be contained.
|
Field Summary |
private java.util.Map |
loggers
|
|
Method Summary |
void |
addLogger(java.lang.String aName,
Logger aLogger)
provide a meaningful name when adding a logger so that it can
be conveniently accessed later, if necessary |
protected boolean |
doLog(LogEntry aLogEntry)
send the log message to contained Loggers. |
Logger |
getLogger(java.lang.String aName)
Return the Logger corresponding with aName |
protected java.util.Map |
getLoggers()
|
void |
removeLogger(java.lang.String aName)
|
protected void |
setLoggers(java.util.Map newLoggers)
|
| Methods inherited from class com.bitfactoryinc.logging.Logger |
getApplication,
getDefaultFilterClass,
getDefaultFormatterClass,
getFilter,
getFormatter,
getSeverityThreshold,
isEnabled,
log,
log,
log,
logCritical,
logCritical,
logDebug,
logDebug,
logError,
logError,
logFatal,
logFatal,
logInfo,
logInfo,
logStatus,
logStatus,
logWarning,
logWarning,
setApplication,
setDefaultFilter,
setDefaultFilterClass,
setDefaultFormatter,
setDefaultFormatterClass,
setEnabled,
setFilter,
setFormatter,
setSeverityThreshold,
shouldLog,
writeToLog |
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
loggers
private java.util.Map loggers
CompositeLogger
public CompositeLogger()
addLogger
public void addLogger(java.lang.String aName,
Logger aLogger)
- provide a meaningful name when adding a logger so that it can
be conveniently accessed later, if necessary
doLog
protected boolean doLog(LogEntry aLogEntry)
- send the log message to contained Loggers.
Assume success, subclasses can fend for themselves upon failure
- Overrides:
- doLog in class Logger
getLogger
public Logger getLogger(java.lang.String aName)
- Return the Logger corresponding with aName
getLoggers
protected java.util.Map getLoggers()
removeLogger
public void removeLogger(java.lang.String aName)
setLoggers
protected void setLoggers(java.util.Map newLoggers)