Re: Modifying logging levels logged in catalina.out at runtime
On 12/1/10 7:59 PM, Jason Pyeron wrote: This may be slightly off-topic. I'll start off with I know how to do this from inside the webapp's code and how to do it by modifing properties files on the system at tomcat startup. But how can it be done from outside the webapp with out restarting tomcat? Yes, it's possible via JMX. Connect JConsole, (or the more recent VisualVM with MBean plugin), to the running process and examine: java.util.logging:type=Logging There is an operation in which you can adjust the log level. This is available programmatically too. Have a good poke around in the MBeans while you're there. You may be surprised at what's else is available. p We are using java.util.logging on tomcat 5.5.23 using jdk 1.6.0_17. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org 0x62590808.asc Description: application/pgp-keys signature.asc Description: OpenPGP digital signature
Modifying logging levels logged in catalina.out at runtime
This may be slightly off-topic. I'll start off with I know how to do this from inside the webapp's code and how to do it by modifing properties files on the system at tomcat startup. But how can it be done from outside the webapp with out restarting tomcat? We are using java.util.logging on tomcat 5.5.23 using jdk 1.6.0_17. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Modifying logging levels logged in catalina.out at runtime
Hopefully you're not creating custom logging levels. Creating custom logging levels is the classic way to create classloader leaks. See the following as an example: http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java You can create a logging.properties file and place it in WEB-INF/classes. You can then change this file, rebuild your application, and redeploy it without taking down Tomcat. You could also add a WatchedResource element to your Context and point it at WEB-INF/classes/logging.properties. When that file is changed, Tomcat will reload the application. See: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html I'm not really sure you want to do the WatchedResource configuration in a production environment though . . . . . . . just my two cents. /mde/ - Original Message From: Jason Pyeron jpye...@pdinc.us To: Tomcat Users List users@tomcat.apache.org Sent: Wed, December 1, 2010 11:59:28 AM Subject: Modifying logging levels logged in catalina.out at runtime This may be slightly off-topic. I'll start off with I know how to do this from inside the webapp's code and how to do it by modifing properties files on the system at tomcat startup. But how can it be done from outside the webapp with out restarting tomcat? We are using java.util.logging on tomcat 5.5.23 using jdk 1.6.0_17. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Modifying logging levels logged in catalina.out at runtime
-Original Message- From: Mark Eggers [mailto:its_toas...@yahoo.com] Sent: Wednesday, December 01, 2010 15:20 To: Tomcat Users List Subject: Re: Modifying logging levels logged in catalina.out at runtime Hopefully you're not creating custom logging levels. Creating Nope, plain jane. custom logging levels is the classic way to create classloader leaks. See the following as an example: http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java You can create a logging.properties file and place it in WEB-INF/classes. You can then change this file, rebuild your application, and redeploy it without taking down Tomcat. Good idea, whould still like to do it without taking down the webapp (that was the intention behind not restarting tomcat) You could also add a WatchedResource element to your Context and point it at WEB-INF/classes/logging.properties. When that file is changed, Tomcat will reload the application. See: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html I'm not really sure you want to do the WatchedResource configuration in a production environment though . . . . . . . just my two cents. Our new applications are putting in a management console to adjust the logging setting, but legacy applications sometimes need to be debugged with out restarting them. Think about leaks where the problem shows up only after 3 months of running. - Original Message From: Jason Pyeron jpye...@pdinc.us To: Tomcat Users List users@tomcat.apache.org Sent: Wed, December 1, 2010 11:59:28 AM Subject: Modifying logging levels logged in catalina.out at runtime This may be slightly off-topic. I'll start off with I know how to do this from inside the webapp's code and how to do it by modifing properties files on the system at tomcat startup. But how can it be done from outside the webapp with out restarting tomcat? We are using java.util.logging on tomcat 5.5.23 using jdk 1.6.0_17. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100- - +1 (443) 269-1555 x333Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Modifying logging levels logged in catalina.out at runtime
I do that by scheduling a thread that every minute checks if my logging.properties file has changed. You may use the timestamp of the file or a change of its MD5 hash to determine that the file has changed. If the file has changed, then I reconfigure the logging library (log4j) with the new contents of the file. I schedule the task when the webapp gets loaded/started and stop the task when the webapp is unloaded/stopped via the ContextListener. It is very handy to change log levels or even enable another appender on the fly. On Wed, Dec 1, 2010 at 6:32 PM, Jason Pyeron jpye...@pdinc.us wrote: -Original Message- From: Mark Eggers [mailto:its_toas...@yahoo.com] Sent: Wednesday, December 01, 2010 15:20 To: Tomcat Users List Subject: Re: Modifying logging levels logged in catalina.out at runtime Hopefully you're not creating custom logging levels. Creating Nope, plain jane. custom logging levels is the classic way to create classloader leaks. See the following as an example: http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java You can create a logging.properties file and place it in WEB-INF/classes. You can then change this file, rebuild your application, and redeploy it without taking down Tomcat. Good idea, whould still like to do it without taking down the webapp (that was the intention behind not restarting tomcat) You could also add a WatchedResource element to your Context and point it at WEB-INF/classes/logging.properties. When that file is changed, Tomcat will reload the application. See: http://tomcat.apache.org/tomcat-5.5-doc/config/context.html I'm not really sure you want to do the WatchedResource configuration in a production environment though . . . . . . . just my two cents. Our new applications are putting in a management console to adjust the logging setting, but legacy applications sometimes need to be debugged with out restarting them. Think about leaks where the problem shows up only after 3 months of running. - Original Message From: Jason Pyeron jpye...@pdinc.us To: Tomcat Users List users@tomcat.apache.org Sent: Wed, December 1, 2010 11:59:28 AM Subject: Modifying logging levels logged in catalina.out at runtime This may be slightly off-topic. I'll start off with I know how to do this from inside the webapp's code and how to do it by modifing properties files on the system at tomcat startup. But how can it be done from outside the webapp with out restarting tomcat? We are using java.util.logging on tomcat 5.5.23 using jdk 1.6.0_17. -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - - - Jason Pyeron PD Inc. http://www.pdinc.us - - Principal Consultant 10 West 24th Street #100 - - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 - - - -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This message is copyright PD Inc, subject to license 20080407P00. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org