|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlogahawk.HashLoggerRegistry
@ThreadSafe public class HashLoggerRegistry
A map based implementation of LoggerRegistry. Loggers must be registered by keys prior to being
retrieved. The look up of key to find Logger is exact -- does not perform partial matching of the
key. (See HierarchicalLoggerRegistry for such functionality.)
This class previously called simply "LoggerRegistry", before the creation of the interface with the same name.
| Field Summary | |
|---|---|
protected ConcurrentHashMap<String,Logger> |
loggerMap
Map from keys to Logger. |
protected Logger |
rootLogger
The default Logger used when failing to find a Logger in the loggerMap. |
| Constructor Summary | |
|---|---|
HashLoggerRegistry(Logger rootLogger)
|
|
| Method Summary | |
|---|---|
void |
clear()
Removes all registered Loggers. |
Logger |
get(Class clazz)
Returns the Logger using Class.getName() as an argument to get(String). |
Logger |
get(String key)
Returns the Logger previously registered with the provided key via put(String, Logger). |
Enumeration<String> |
getKeys()
Returns the keys of all registered Loggers. |
Logger |
getRootLogger()
Returns the root (or default) Logger. |
void |
put(String key,
Logger logger)
Registers a Logger for the provided key. |
void |
remove(String key)
Remove a Logger registered under the provided key. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Logger rootLogger
protected final ConcurrentHashMap<String,Logger> loggerMap
Logger. A Logger can be registered under multiple keys.
| Constructor Detail |
|---|
public HashLoggerRegistry(Logger rootLogger)
| Method Detail |
|---|
public Logger getRootLogger()
LoggerRegistryLogger. The default is used when no Logger matches (String) .
getRootLogger in interface LoggerRegistrypublic Logger get(String key)
Logger previously registered with the provided key via put(String, Logger). The
look up is exact -- does not perform partial matches.
get in interface LoggerRegistrypublic Logger get(Class clazz)
Logger using Class.getName() as an argument to get(String).
get in interface LoggerRegistrypublic Enumeration<String> getKeys()
Loggers.
public void put(String key,
Logger logger)
Logger for the provided key.
key - This cannot be null or the empty string -- that corresponds to the rootLogger.public void clear()
Loggers.
public void remove(String key)
Logger registered under the provided key.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||