View Full Version : Controlling log4j levels using Spring JMX
jbetancourt
Oct 6th, 2005, 12:51 PM
Just saw this interesting post:
http://www.jroller.com/page/klejs?entry=log4j_and_jmx
Costin Leau
Oct 6th, 2005, 04:55 PM
I had the same problem but I wanted a more complete solution - using the exporter it was a very straight forward move - publish the configuration through a simple wrapper bean and you could see the logger defined and their level.
The problem was that the core classes for Log4j are not serializable so I had to come up with another alternatives like the one here. Ofc, one alternative would be to transport the log4j classes through some serializable objects but I didn't like the solution too much and I abandon it.
Logging mania, I'm telling you :)
siberian
Oct 8th, 2005, 12:38 AM
I had the same problem but I wanted a more complete solution - using the exporter it was a very straight forward move - publish the configuration through a simple wrapper bean and you could see the logger defined and their level.
The problem was that the core classes for Log4j are not serializable so I had to come up with another alternatives like the one here. Ofc, one alternative would be to transport the log4j classes through some serializable objects but I didn't like the solution too much and I abandon it.
Logging mania, I'm telling you :)
May be you can use scripts(beanshell or something) to change the logger's level on runtime.
Define a wrapper bean of beanshell engine.
Define a wrapper bean of log4j's root Category, and add it to the beanshell engine's namespace, It is easy to run "root.setLevel()" in a beanshell console.
Indeed I have tried this. But I don't know if anyelse will be interested in it :lol:
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.