|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object logahawk.HierarchicalLoggerRegistry
public class HierarchicalLoggerRegistry
A hierarchical based implementation of LoggerRegistry
. Logger
s 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 Logger s. |
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 Logger s. |
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()
LoggerRegistry
Logger
. The default is used when no Logger
matches (String)
.
getRootLogger
in interface LoggerRegistry
public 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 LoggerRegistry
public Logger get(Class clazz)
Logger
using Class.getName()
as an argument to get(String)
.
get
in interface LoggerRegistry
public Enumeration<String> getKeys()
Logger
s.
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()
Logger
s.
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 |