|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectlogahawk.HierarchicalLoggerRegistry
public class HierarchicalLoggerRegistry
A hierarchical based implementation of LoggerRegistry. Loggers must be registered by package
name
being
retrieved. The look up of key to find Logger is not exact See HashLoggerRegistry for such
functionality.
| 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 | |
|---|---|
HierarchicalLoggerRegistry(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 path)
Returns the Logger for the provided class path. |
Enumeration<String> |
getKeys()
Returns the keys of all registered Loggers. |
protected String |
getParentPath(String path)
Returns a more general (or more "root") path from the given path. |
Logger |
getRootLogger()
Returns the root (or default) Logger. |
void |
put(String path,
Logger logger)
Registers a Logger for the provided class path. |
void |
remove(String path)
Remove a Logger registered under the provided path. |
| 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 HierarchicalLoggerRegistry(Logger rootLogger)
| Method Detail |
|---|
public Logger getRootLogger()
LoggerRegistryLogger. The default is used when no Logger matches (String) .
getRootLogger in interface LoggerRegistrypublic Logger get(String path)
Logger for the provided class path. This first attempts an exact match on the full class
name, and failing that it works its way up the package path looking for the next best fit.
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 path,
Logger logger)
Logger for the provided class path.
path - The path to register Logger. This can be a package path or a specific Class.getName(). This cannot be null or the empty string -- that corresponds to the rootLogger.public void clear()
Loggers.
public void remove(String path)
Logger registered under the provided path.
protected String getParentPath(String path)
rootLogger should likely be used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||