logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jess Holle <je...@ptc.com>
Subject Re: Changing logging levels in Log4J dynamically?
Date Fri, 26 Oct 2007 01:32:39 GMT
Though I believe there have been recent fixes to it, I ended up giving 
up on the JMX package in log4j and writing my own.

You may be able to make it work well enough for your cases if you only 
have a single LoggerRepository, though.  If not, well last I saw it had 
no notion or ability to cope with multiple repositories and I'd suggest 
using the code as an sample code for writing your own at that point -- 
taking what you like and leaving the rest :-)

As for documentation, I'd suggest running with Java 5, adding the bit of 
code to register the MBeans, connecting to your running app with 
jconsole and playing around.  You'll quickly see what's handled to your 
liking and what's not this way.

Besides JMX, there's always just calling setLevel() yourself -- as 
triggered by an HTTP request, for example.  You can also watch for 
modifications to the log4j configuration file and reconfigure when it 
changes -- not instantaneous, but still no restart required.

--
Jess Holle

Will Sargent wrote:
> Hi all,
>
> I've heard several people ask if you can change log4j levels
> dynamically, once the application is already running. I see that
> there's a JMX package in 1.2.14, but there doesn't seem to be any
> javadoc or documentation attached to it.  If there is, can someone
> point me to it?
>
> Will.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>   


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


Mime
View raw message