
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

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. 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. On Wed, Jul 8, 2009 at 5:35 AM, alex <alessandro.fustini@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 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

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@dnshosting.it <mailto:alessandro.fustini@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

On Wed, Jul 8, 2009 at 9:19 AM, Ceki Gulcu <ceki@qos.ch> wrote:
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.
Without that JConsole would never connect. After a little more research, it looks like I had this problem because my `hostname` wasn't in /etc/hosts as 127.0.0.1. Once I fixed that I was able to connect without the CATALINA_OPTS. Let that be a lesson: always make sure your hostname resolves to 127.0.0.1 or weird stuff can break, like local JMX. Nik Everett

I provided some code on http://jira.qos.ch/browse/LBCORE-59 that automatically reconfigures when the configuration file is modified. Ralph On Jul 8, 2009, at 2:35 AM, alex 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 _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

Thanks a lot for all fast answers !! Ralph Goers wrote:
I provided some code on http://jira.qos.ch/browse/LBCORE-59 that automatically reconfigures when the configuration file is modified.
Ralph
On Jul 8, 2009, at 2:35 AM, alex 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 _______________________________________________ Logback-user mailing list Logback-user@qos.ch <mailto:Logback-user@qos.ch> http://qos.ch/mailman/listinfo/logback-user
------------------------------------------------------------------------
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (4)
-
alex
-
Ceki Gulcu
-
Nikolas Everett
-
Ralph Goers