Class LoggerHierarchy

Description

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.

  • author: Marco Vassura
  • version: $Revision: 556801 $

Located in /LoggerHierarchy.php (line 46)


	
			
Variable Summary
Method Summary
static void singleton ()
LoggerHierarchy __construct (object $root)
void addHierarchyEventListener ( $listener)
void addRenderer (string $classToRender, LoggerObjectRenderer $or)
void clear ()
void emitNoAppenderWarning ( $cat)
boolean exists (string $name)
void fireAddAppenderEvent (Logger $logger, LoggerAppender $appender)
Logger getLogger (string $name, [LoggerFactory $factory = null])
Logger getLoggerByFactory (string $name,  $factory)
boolean isDisabled ( $level)
void overrideAsNeeded ( $override)
void setDisableOverride ( $override)
void setRenderer (string $renderedClass, LoggerRenderer $renderer)
void shutdown ()
Variables
boolean $debug = false (line 57)
  • var: activate internal logging
  • see: LoggerLog
  • access: public
object currently $defaultFactory (line 51)
  • var: unused
  • access: protected
boolean $emittedNoAppenderWarning = false (line 82)
  • var: currently unused
  • access: protected
boolean $emittedNoResourceBundleWarning = false (line 87)
  • var: currently unused
  • access: protected
array $ht = array() (line 62)
  • var: hierarchy tree. saves here all loggers
  • access: protected
LoggerRendererMap $rendererMap (line 72)
  • access: protected
LoggerRoot $root = null (line 67)
  • access: protected
LoggerLevel $threshold (line 77)
  • var: main level threshold
  • access: protected
Methods
static method singleton (line 89)
  • access: public
static void singleton ()
Constructor __construct (line 102)

Create a new logger hierarchy.

  • access: protected
LoggerHierarchy __construct (object $root)
  • object $root: the root logger
addHierarchyEventListener (line 116)

Add a HierarchyEventListener event to the repository.

Not Yet Impl.

  • access: public
void addHierarchyEventListener ( $listener)
  • $listener
addRenderer (line 126)

Add an object renderer for a specific class.

  • access: public
void addRenderer (string $classToRender, LoggerObjectRenderer $or)
clear (line 134)

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

  • access: public
void clear ()
emitNoAppenderWarning (line 139)
  • access: public
void emitNoAppenderWarning ( $cat)
  • $cat
exists (line 149)

Check if the named logger exists in the hierarchy.

  • access: public
boolean exists (string $name)
  • string $name
fireAddAppenderEvent (line 159)

Not Implemented.

  • access: public
void fireAddAppenderEvent (Logger $logger, LoggerAppender $appender)
getCurrentCategories (line 167)
void getCurrentCategories ()
getCurrentLoggers (line 176)

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

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

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

  • access: public
Logger getLogger (string $name, [LoggerFactory $factory = null])
getLoggerByFactory (line 204)

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

Logger getLoggerByFactory (string $name,  $factory)
  • string $name: logger name
  • $factory
getRendererMap (line 233)
  • return: Get the renderer map for this hierarchy.
  • access: public
LoggerRendererMap getRendererMap ()
getRootLogger (line 241)
  • return: Get the root of this hierarchy.
  • access: public
LoggerRoot getRootLogger ()
getThreshold (line 251)
  • return: Returns the threshold Level.
  • access: public
LoggerLevel getThreshold ()
isDisabled (line 261)

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

  • access: public
boolean isDisabled ( $level)
  • $level
overrideAsNeeded (line 269)
  • deprecated: Deprecated with no replacement.
  • access: public
void overrideAsNeeded ( $override)
  • $override
resetConfiguration (line 289)

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 ()
setDisableOverride (line 310)
  • deprecated: Deprecated with no replacement.
  • access: public
void setDisableOverride ( $override)
  • $override
setRenderer (line 321)

Used by subclasses to add a renderer to the hierarchy passed as parameter.

  • access: public
void setRenderer (string $renderedClass, LoggerRenderer $renderer)
  • string $renderedClass: a LoggerRenderer class name
  • LoggerRenderer $renderer
setThreshold (line 331)

set a new threshold level

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

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 by phpDocumentor 1.3.2