The casual user does not have to deal with this class directly.
The structure of the logger hierarchy is maintained by the getLogger method. The hierarchy is such that children link to their parent but parents do not have any pointers to their children. Moreover, loggers can be instantiated in any order, in particular descendant before ancestor.
In case a descendant is created before a particular ancestor, then it creates a provision node for the ancestor and adds itself to the provision node. Other descendants of the same ancestor add themselves to the previously created provision node.
Public Member Functions | |
Hierarchy () | |
Create a new logger hierarchy. | |
~Hierarchy () | |
void | addRef () const |
void | releaseRef () const |
void | addHierarchyEventListener (const spi::HierarchyEventListenerPtr &listener) |
void | clear () |
This call will clear all logger definitions from the internal hashtable. | |
void | emitNoAppenderWarning (const LoggerPtr &logger) |
LoggerPtr | exists (const LogString &name) |
Check if the named logger exists in the hierarchy. | |
void | setThreshold (const LogString &levelStr) |
The string form of setThreshold. | |
void | setThreshold (const LevelPtr &l) |
Enable logging for logging requests with level l or higher. | |
void | fireAddAppenderEvent (const LoggerPtr &logger, const AppenderPtr &appender) |
void | fireRemoveAppenderEvent (const LoggerPtr &logger, const AppenderPtr &appender) |
const LevelPtr & | getThreshold () const |
Returns a Level representation of the enable state. | |
LoggerPtr | getLogger (const LogString &name) |
Return a new logger instance named as the first parameter using the default factory. | |
LoggerPtr | getLogger (const LogString &name, const spi::LoggerFactoryPtr &factory) |
Return a new logger instance named as the first parameter using factory . | |
LoggerList | getCurrentLoggers () const |
Returns all the currently defined loggers in this hierarchy as a LoggerList. | |
LoggerPtr | getRootLogger () const |
Get the root of this hierarchy. | |
bool | isDisabled (int level) const |
This method will return true if this repository is disabled for level object passed as parameter and false otherwise. | |
void | resetConfiguration () |
Reset all values contained in this hierarchy instance to their default. | |
void | shutdown () |
Shutting down a hierarchy will safely close and remove all appenders in all categories including the root logger. | |
virtual bool | isConfigured () |
virtual void | setConfigured (bool configured) |
|
Create a new logger hierarchy.
|
|
|
|
|
|
Reimplemented from ObjectImpl. |
|
This call will clear all logger definitions from the internal hashtable. Invoking this method will irrevocably mess up the logger hierarchy. You should really know what you are doing before invoking this method. |
|
Implements LoggerRepository. |
|
Check if the named logger exists in the hierarchy.
If so return its reference, otherwise returns
Implements LoggerRepository. |
|
Implements LoggerRepository. |
|
|
|
Returns all the currently defined loggers in this hierarchy as a LoggerList. The root logger is not included in the returned LoggerList. Implements LoggerRepository. |
|
Return a new logger instance named as the first parameter using
If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated by the
Implements LoggerRepository. |
|
Return a new logger instance named as the first parameter using the default factory. If a logger of that name already exists, then it will be returned. Otherwise, a new logger will be instantiated and then linked with its existing ancestors as well as children.
Implements LoggerRepository. |
|
Get the root of this hierarchy.
Implements LoggerRepository. |
|
Returns a Level representation of the
Implements LoggerRepository. |
|
Implements LoggerRepository. |
|
This method will return See also the setThreshold method. Implements LoggerRepository. |
|
Reimplemented from ObjectImpl. |
|
Reset all values contained in this hierarchy instance to their default.
This removes all appenders from all categories, sets the level of all non-root categories to Existing categories are not removed. They are just reset. This method should be used sparingly and with care as it will block all logging until it is completed. Implements LoggerRepository. |
|
Implements LoggerRepository. |
|
Enable logging for logging requests with level By default all levels are enabled.
Implements LoggerRepository. |
|
The string form of setThreshold.
Implements LoggerRepository. |
|
Shutting down a hierarchy will safely close and remove all appenders in all categories including the root logger. Some appenders such as SocketAppender and AsyncAppender need to be closed before the application exists. Otherwise, pending logging events might be lost.
The Implements LoggerRepository. |