logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject RE: Watchdogs
Date Tue, 01 Feb 2005 17:47:34 GMT
At 06:19 PM 2/1/2005, Mark Womack wrote:
>Well, my prediction was wrong.  If I call JoranConfigurator subsequent
>times, each time using a config file that does not duplicate previous
>appenders, etc, then I do not get the double logging.  Cool.
>So, I started looking at doing my own ResetConfigurationAction class and
>attaching it to the JoranConfigurator.  However, I think there will be some
>issues with this.
>I wrote the action to perform a resetConfiguration(), instead of a

The fact that Hierarchy has two methods, shutdown and resetConfiguration() 
both performing the same action, a very important one at that, is not good. 
The resetConfiguration() method should not exist.

>That seemed a better choice for what it is trying to
>accomplish.  But, if I do this while Joran is parsing or replaying the
>events, it will have the effect of removing any temporary appenders that are
>attached, such as the list appender that Joran attaches.  The internal
>console appender that the ConfigurationAction attaches, when the "debug"
>attribute is true, appears to be unharmed.

The temporary ConsoleAppender should be closed and detached as any other 
appender. If it isn't closed then there is a bug in the 
Hierarchy.resetConfiguration() method.

>I also tried it by modifying the ConfigurationAction to recognize a "reset"
>attribute, but since the resetConfiguration() is happening in an action,
>after the JoranConfigurator has attached the list appender, that appender
>still gets removed.
>Either way, I get an error message saying the list appender cannot be found.
>I did not have a chance to look at it in detail yet.  What is this list
>appender used for?

That is what I tried to explain in my last message.

Joran uses the list appender to replay events. See also 
ConfiguratorBase.attachListAppender and detachListAppender methods and how 
they are used in JoranConfigurator.doConfigure(ParseAction, 
LoggerRepository) method.

What you need to do in your ResetAction is to detach the temporary console 
appender (if it exists) and the temporary list appender, and re-attach them 
after resetting the environment. You can detach an appender by calling 
removeAppender(String) on the appropriate logger. Note that the 
Category.removeAppender(String) method does NOT close the appender being 


Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/

To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message