# Class LoggerHierarchy

This class is specialized in retrieving loggers by name and also maintaining the logger hierarchy. The logger hierarchy is dealing with the several Log-Levels Logger can have. From log4j website:

"A logger is said to be an ancestor of another logger if its name followed by a dot is a prefix of the descendant logger name. A logger is said to be a parent of a child logger if there are no ancestors between itself and the descendant logger."

Child Loggers do inherit their Log-Levels from their Ancestors. They can increase their Log-Level compared to their Ancestors, but they cannot decrease it.

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.

Package: log4php
Version: $Revision: 1394956 $
Located at LoggerHierarchy.php

Methods summary
`public` | # `__construct( `LoggerRoot` $root )` Creates a new logger hierarchy. Creates a new logger hierarchy. #### Parameters $root ``LoggerRoot`` $root The root logger.
`public` | # `clear( )` Clears all loggers. Clears all loggers.
`public boolean` | # `exists( string $name )` Check if the named logger exists in the hierarchy. Check if the named logger exists in the hierarchy. #### Parameters $name `string` $name #### Returns `boolean`
`public array` | # `getCurrentLoggers( )` Returns all the currently defined loggers in this hierarchy as an array. Returns all the currently defined loggers in this hierarchy as an array. #### Returns `array`
`public `Logger`` | # `getLogger( string $name )` Returns a named logger instance logger. If it doesn't exist, one is created. Returns a named logger instance logger. If it doesn't exist, one is created. #### Parameters $name `string` $name Logger name #### Returns ``Logger`` Logger instance.
`public `LoggerRendererMap`` | # `getRendererMap( )` Returns the logger renderer map. Returns the logger renderer map. #### Returns ``LoggerRendererMap``
`public `LoggerRoot`` | # `getRootLogger( )` Returns the root logger. Returns the root logger. #### Returns ``LoggerRoot``
`public `LoggerLevel`` | # `getThreshold( )` Returns the main threshold level. Returns the main threshold level. #### Returns ``LoggerLevel``
`public boolean` | # `isDisabled( `LoggerLevel` $level )` Returns true if the hierarchy is disabled for given log level and false otherwise. Returns true if the hierarchy is disabled for given log level and false otherwise. #### Returns `boolean`
`public` | # `resetConfiguration( )` Reset all values contained in this hierarchy instance to their default. Reset all values contained in this hierarchy instance to their default. This removes all appenders from all loggers, sets the level of all non-root loggers to null, sets their additivity flag to true and sets the level of the root logger to LOGGER_LEVEL_DEBUG. Existing loggers 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.
`public` | # `setThreshold( `LoggerLevel` $threshold )` Sets the main threshold level. Sets the main threshold level. #### Parameters $threshold ``LoggerLevel`` $l
`public` | # `shutdown( )` Shutting down a hierarchy will safely close and remove all appenders in all loggers including the root logger. Shutting down a hierarchy will safely close and remove all appenders in all loggers 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.
`public` | # `printHierarchy( )` Prints the current Logger hierarchy tree. Useful for debugging. Prints the current Logger hierarchy tree. Useful for debugging.

Properties summary
`protected array` | $loggers | `array()` | # Array holding all Logger instances. Array holding all Logger instances.
`protected RootLogger` | $root | `` | # The root logger. The root logger.
`protected `LoggerRendererMap`` | $rendererMap | `` | # The logger renderer map. The logger renderer map.
`protected `LoggerLevel`` | $threshold | `` | # Main level threshold. Events with lower level will not be logged by any logger, regardless of it's configuration. Main level threshold. Events with lower level will not be logged by any logger, regardless of it's configuration.