You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "DeSantis, MJ Mark @ IS (7179)" <Ma...@L-3com.com> on 2006/02/07 22:02:38 UTC

JoranConfigurator configuration of log4j

This is more of a "just out of curiousity" type question.
 
When I configure log4j in the code (using the JoranConfigurator) with an xml
file. I get what you would expect - all my appenders and such defined in the
xml file are instanciated. If I decide to reconfigure log4j using the same
xml config file, while log4j is still running, I find something that I
wouldn't really expect - the reconfigure puts duplicates of all the
appenders and such. So if my config file defined a SocketAppender and a
JmsAppender attached to the root logger, and I configure log4j with that
file, when I do a reconfigure with the same file I get two SocketAppenders
and two JmsAppenders on the root logger.
 
I was just wondering if this was intended behaviour. I just ask because I
know the JoranConfigurator is new, and behaviour can obviously change from
alpha to beta to final release.
 
If this is behaviour is intended, then is there a conveinent way of
"unconfiguring" log4j so in memory it is "primed" to be configured by the
same configuration file? (am I making sense? let me know if I'm not).
 
 
Mark

Re: JoranConfigurator configuration of log4j

Posted by dirk ooms <di...@onesparrow.com>.
applying resetConfiguration to the LoggerRepository before reconfiguring will 
resolve this.

dirk

On Tuesday 07 February 2006 22:02, DeSantis, MJ Mark @ IS (7179) wrote:
> This is more of a "just out of curiousity" type question.
>
> When I configure log4j in the code (using the JoranConfigurator) with an
> xml file. I get what you would expect - all my appenders and such defined
> in the xml file are instanciated. If I decide to reconfigure log4j using
> the same xml config file, while log4j is still running, I find something
> that I wouldn't really expect - the reconfigure puts duplicates of all the
> appenders and such. So if my config file defined a SocketAppender and a
> JmsAppender attached to the root logger, and I configure log4j with that
> file, when I do a reconfigure with the same file I get two SocketAppenders
> and two JmsAppenders on the root logger.
>
> I was just wondering if this was intended behaviour. I just ask because I
> know the JoranConfigurator is new, and behaviour can obviously change from
> alpha to beta to final release.
>
> If this is behaviour is intended, then is there a conveinent way of
> "unconfiguring" log4j so in memory it is "primed" to be configured by the
> same configuration file? (am I making sense? let me know if I'm not).
>
>
> Mark

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