|
Apache Log4cxx
Version 2.0.0
|
This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy. More...
#include <hierarchy.h>
Public Member Functions | |
| ~Hierarchy () | |
| void | addHierarchyEventListener (const spi::HierarchyEventListenerPtr &listener) override |
Notify listener when an Appender is added or removed from a logger in the repository. | |
| void | removeHierarchyEventListener (const spi::HierarchyEventListenerPtr &listener) override |
Stop notifying listener when an Appender is added or removed from a logger in the repository. | |
| void | ensureIsConfigured (std::function< void()> configurator) override |
Call configurator if not yet configured and configurator has not already been tried. | |
| void | clear () |
| This call will clear all logger definitions from the internal hashtable. | |
| void | emitNoAppenderWarning (const Logger *logger) override |
Add a warning to internal debug output that logger does not have any Appender attached. | |
| LoggerPtr | exists (const LogString &name) override |
Does name exist in the repository? | |
| void | setThreshold (const LogString &newLevel) override |
Enable logging for logging requests with level newLevel or higher. | |
| void | setThreshold (const LevelPtr &newLevel) override |
Enable logging for logging requests with level newLevel or higher. | |
| void | fireAddAppenderEvent (const Logger *logger, const Appender *appender) override |
| Call addAppenderEvent on all registered listeners. | |
| void | fireRemoveAppenderEvent (const Logger *logger, const Appender *appender) override |
| Call removeAppenderEvent on all registered listeners. | |
| LevelPtr | getThreshold () const override |
| The current repository-wide threshold. | |
| LoggerPtr | getLogger (const LogString &name, const spi::LoggerFactoryPtr &factory={}) override |
| The current repository-wide threshold. | |
| LoggerList | getCurrentLoggers () const override |
| All the loggers currently defined in this repository. | |
| LoggerPtr | getRootLogger () const override |
| The logger that cannot be retrieved by name. | |
| bool | isDisabled (int level) const override |
Is the repository disabled for level? | |
| void | resetConfiguration () override |
| Reset all values contained in this repository instance to their default. | |
| void | shutdown () override |
| Shutting down a hierarchy will safely close and remove all appenders in all categories including the root logger. | |
| virtual bool | isConfigured () override |
| The value of the configured status. | |
| virtual void | setConfigured (bool configured) override |
Set the configured status to true. | |
| void | updateChildren (const Logger *parent) override |
Refresh the configuration of all loggers where parent is somewhere in their ancestor chain. | |
| bool | removeLogger (const LogString &name, bool ifNotUsed=true) override |
Remove the name Logger from the repository. | |
| Public Member Functions inherited from log4cxx::spi::LoggerRepository | |
| virtual | ~LoggerRepository () |
| Public Member Functions inherited from log4cxx::helpers::Object | |
| virtual | ~Object () |
| virtual const helpers::Class & | getClass () const =0 |
| virtual bool | instanceof (const Class &clazz) const =0 |
| virtual const void * | cast (const Class &clazz) const =0 |
Static Public Member Functions | |
| static HierarchyPtr | create () |
| Create a new logger hierarchy. | |
This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy.
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.
| log4cxx::Hierarchy::~Hierarchy | ( | ) |
|
overridevirtual |
Notify listener when an Appender is added or removed from a logger in the repository.
Implements log4cxx::spi::LoggerRepository.
| void log4cxx::Hierarchy::clear | ( | ) |
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.
|
static |
Create a new logger hierarchy.
|
overridevirtual |
Add a warning to internal debug output that logger does not have any Appender attached.
To avoid overloading the output stream, the warning is emitted only once.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Call configurator if not yet configured and configurator has not already been tried.
If configurator succeeds, it must call LoggerRepository::setConfigured to ensure subsequent calls to LoggerRepository::ensureIsConfigured from overwriting the configuration.
Implements log4cxx::spi::LoggerRepository.
Does name exist in the repository?
name exists in the repository. Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Call addAppenderEvent on all registered listeners.
Reimplemented from log4cxx::spi::LoggerRepository.
|
overridevirtual |
Call removeAppenderEvent on all registered listeners.
Reimplemented from log4cxx::spi::LoggerRepository.
|
overridevirtual |
All the loggers currently defined in this repository.
The root logger is not included in the returned LoggerList.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
The current repository-wide threshold.
See setThreshold for an explanation.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
The logger that cannot be retrieved by name.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
The current repository-wide threshold.
See setThreshold for an explanation.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
The value of the configured status.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Is the repository disabled for level?
The answer depends on the repository threshold and the level parameter. See also the setThreshold method.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Stop notifying listener when an Appender is added or removed from a logger in the repository.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Remove the name Logger from the repository.
Note: The name Logger must be retrieved from the repository after any subsequent configuration file change for the newly loaded settings to be used.
| name | The logger to remove. |
| ifNotUsed | If true and use_count() indicates there are other references, do not remove the Logger and return false. |
name Logger was removed from the repository. Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Reset all values contained in this repository instance to their default.
This removes all appenders from all categories, sets the level of all non-root categories to null, sets their additivity flag to true and sets the level of the root logger to DEBUG. Also the repository wide threshold is set its default "ALL" value.
Existing categories are not removed.
This method should be used sparingly and with care as it will block all logging until this is configured again.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Set the configured status to true.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Enable logging for logging requests with level newLevel or higher.
All logging requests below the threshold are immediately dropped. By default, the threshold is set to Level::getAll() which has the lowest possible rank.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Enable logging for logging requests with level newLevel or higher.
The threshold is set the DEBUG if newLevel is not recognised by Level::getLevel. All logging requests below the threshold are immediately dropped. By default, the threshold is set to Level::getAll() which has the lowest possible rank.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Shutting down a hierarchy will safely close and remove all appenders in all categories including the root logger.
The shutdown method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a logger and again to a nested appender.
Implements log4cxx::spi::LoggerRepository.
|
overridevirtual |
Refresh the configuration of all loggers where parent is somewhere in their ancestor chain.
The ancestor chain ends at the root logger.
Implements log4cxx::spi::LoggerRepository.