org.apache.commons.digester.plugins
Class LogUtils

java.lang.Object
  |
  +--org.apache.commons.digester.plugins.LogUtils

class LogUtils
extends java.lang.Object

Simple utility class to assist in logging.

This class is intended only for the use of the code in the plugins packages. No "user" code should use this package.

The Digester module has an interesting approach to logging: all logging should be done via the Log object stored on the digester instance that the object *doing* the logging is associated with.

This is done because apparently some "container"-type applications such as Avalon and Tomcat need to be able to configure different logging for different instances of the Digester class which have been loaded from the same ClassLoader [info from Craig McClanahan]. Not only the logging of the Digester instance should be affected; all objects associated with that Digester instance should obey the reconfiguration of their owning Digester instance's logging. The current solution is to force all objects to output logging info via a single Log object stored on the Digester instance they are associated with.

Of course this causes problems if logging is attempted before an object has a valid reference to its owning Digester. The getLogging method provided here resolves this issue by returning a Log object which silently discards all logging output in this situation.

And it also implies that logging filtering can no longer be applied to subcomponents of the Digester, because all logging is done via a single Log object (a single Category). C'est la vie...

Since:
1.6

Constructor Summary
(package private) LogUtils()
           
 
Method Summary
(package private) static org.apache.commons.logging.Log getLogger(Digester digester)
          Get the Log object associated with the specified Digester instance, or a "no-op" logging object if the digester reference is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogUtils

LogUtils()
Method Detail

getLogger

static org.apache.commons.logging.Log getLogger(Digester digester)
Get the Log object associated with the specified Digester instance, or a "no-op" logging object if the digester reference is null.

You should use this method instead of digester.getLogger() in any situation where the digester might be null.



Copyright (c) 2001-2004 - Apache Software Foundation