[logback-user] Change log level at runtime

Ceki Gulcu ceki at qos.ch
Wed Jul 8 15:19:44 CEST 2009



Nikolas Everett wrote:
> You can do that.  See here:  
> http://logback.qos.ch/manual/jmxConfig.html  I typically change my 
> logback configuration file on the file system then use jconsole to 
> request that logback reload it. 
> 
> You may have to jump through some hoops to get jconsole to connect to a 
> running application server.  I stuff these in my .bashrc on development 
> box to make it simple:
>   CATALINA_OPTS="-Dcom.sun.management.jmxremote 
> -Dcom.sun.management.jmxremote.port=8999 
> -Dcom.sun.management.jmxremote.ssl=false 
> -Dcom.sun.management.jmxremote.authenticate=false 
> -Djava.rmi.server.hostname=localhost"
>   export CATALINA_OPTS
> Thats about the lease secure way you could setup JMX, but it gets the 
> job done for development.

AFAIK, JMX requires no configuration with JDK 1.6. After adding
<jmxConfigurator/> into logback.xml, you just run jconsole. Does your
experience differ?

Otherwise, if running under JDK 1.5, the steps you describe look good.


> 
> Just as a side note, http://logback.qos.ch/manual/index.html links to 
> http://logback.qos.ch/manual/jmxConfig.html as 
> http://logback.qos.ch/manual/jmxConfigurator.html which 404s. 

Fixed it. Thank you.

> On Wed, Jul 8, 2009 at 5:35 AM, alex <alessandro.fustini at dnshosting.it 
> <mailto:alessandro.fustini at dnshosting.it>> wrote:
> 
>     Hi,
>     Is it possible to change at runtime (with no restart the server) the
>     log level for an appender (for example from error to info) ?
>     If yes is it possible to have some code hints ?
> 
>     Thanks a lot for all help

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the Logback-user mailing list