Class LoggerHierarchy

Description

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.

<p>The casual user does not have to deal with this class directly.</p>

<p>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.</p>

<p>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.</p>

  • version: $Revision: 822448 $

Located in /LoggerHierarchy.php (line 56)


	
			
Variable Summary
mixed $ht
mixed $rendererMap
mixed $root
mixed $threshold
Method Summary
LoggerHierarchy __construct (LoggerRoot $root)
void clear ()
boolean exists (string $name)
Logger getLogger (string $name, LoggerFactory $factory)
boolean isDisabled (LoggerLevel $level)
void shutdown ()
Variables
mixed $defaultFactory (line 58)

Default Factory

  • access: protected
mixed $ht = array() (line 61)

array hierarchy tree. saves here all loggers

  • access: protected
mixed $rendererMap (line 67)

LoggerRendererMap

  • access: protected
mixed $root = null (line 64)

The root Logger

  • access: protected
mixed $threshold (line 70)

LoggerLevel main level threshold

  • access: protected
Methods
Constructor __construct (line 76)

Create a new logger hierarchy.

  • access: public
LoggerHierarchy __construct (LoggerRoot $root)
  • object $root: the root logger
clear (line 85)

This call will clear all logger definitions from the internal hashtable.

  • access: public
void clear ()
exists (line 94)

Check if the named logger exists in the hierarchy.

  • access: public
boolean exists (string $name)
  • string $name
getCurrentLoggers (line 102)

Returns all the currently defined categories in this hierarchy as an array.

  • access: public
array getCurrentLoggers ()
getLogger (line 113)

Return a new logger instance named as the first parameter using the default factory.

  • access: public
Logger getLogger (string $name, LoggerFactory $factory)
  • string $name: logger name
  • LoggerFactory $factory: a LoggerFactory instance or null
getRendererMap (line 149)
  • return: Get the renderer map for this hierarchy.
  • access: public
LoggerRendererMap getRendererMap ()
getRootLogger (line 156)
  • return: Get the root of this hierarchy.
  • access: public
LoggerRoot getRootLogger ()
getThreshold (line 166)
  • return: Returns the threshold Level.
  • access: public
LoggerLevel getThreshold ()
isDisabled (line 175)

This method will return true if this repository is disabled for level object passed as parameter and false otherwise.

  • access: public
boolean isDisabled (LoggerLevel $level)
resetConfiguration (line 194)

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 null, sets their additivity flag to true and sets the level of the root logger to LOGGER_LEVEL_DEBUG. Moreover, message disabling is set its default "off" value.

<p>Existing categories are not removed. They are just reset.

<p>This method should be used sparingly and with care as it will block all logging until it is completed.</p>

  • access: public
void resetConfiguration ()
setThreshold (line 215)

set a new threshold level

  • access: public
void setThreshold (LoggerLevel $l)
shutdown (line 235)

Shutting down a hierarchy will safely close and remove all appenders in all categories including the root logger.

Some appenders such as LoggerSocketAppender need to be closed before the application exists. Otherwise, pending logging events might be lost.

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.

  • access: public
void shutdown ()

Documentation generated on Fri, 27 Nov 2009 07:44:50 +0100 by phpDocumentor 1.4.3