Re: Changing logging level at runtime
Just some random ideas you could explore... It is possible to expose Log4J via JMX. Hivemind (Tapestry 4) used to do this with a simple piece of configuration (http://hivemind.apache.org/hivemind1/hivemind-jmx/manageLog4j.html). A bit of Googling shows how you can do Log4J level changes with a simple JMX bean and JConsole: http://technology.amis.nl/blog/1238/modify-spring-beans-and-log4j-levels-on-a-running-server-with-jmx-and-jconsole And where this gets really interesting is if you have multiple servers (e.g. tiered architectures and/or clusters), it's really easy to script JMX across multiple servers using JRuby and jmx4r: http://github.com/jmesnil/jmx4r/tree/master Hope something in that lot is useful for you :-) Paul -- Paul Field Research IT Deutsche Bank Peter Stavrinides 19/05/2009 14:40 Please respond to "Tapestry users" To Tapestry users cc Subject Re: Changing logging level at runtime I have seen this code used with configureAndWatch: URL url = this.getClass().getResource("log4j.properties"); // Configure the properties and observe the file every 2 seconds PropertyConfigurator.configureAndWatch(url.getPath(), 2000); But it is said to be problematic as it may cause issues with shutting down classloaders!? so that is why a configuration application is recommended. Peter - Original Message - From: "Borut Bolčina" To: "List Tapestry User" Sent: Tuesday, 19 May, 2009 14:39:07 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Changing logging level at runtime Hi, I've been using log4j's configureAndWatch in some of my backend java apps. I want to be able to change log4j.properties for my T5.0.18 web app and see the change (log level) in my logs without restarting Tomcat. My goal is to switch to debug level when I see "fishy behaviur" in the production deployed apps. How to achive this in best practice? -Borut - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --- This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional EU corporate and regulatory disclosures.
Re: Changing logging level at runtime
I have seen this code used with configureAndWatch: URL url = this.getClass().getResource("log4j.properties"); // Configure the properties and observe the file every 2 seconds PropertyConfigurator.configureAndWatch(url.getPath(), 2000); But it is said to be problematic as it may cause issues with shutting down classloaders!? so that is why a configuration application is recommended. Peter - Original Message - From: "Borut Bolčina" To: "List Tapestry User" Sent: Tuesday, 19 May, 2009 14:39:07 GMT +02:00 Athens, Beirut, Bucharest, Istanbul Subject: Changing logging level at runtime Hi, I've been using log4j's configureAndWatch in some of my backend java apps. I want to be able to change log4j.properties for my T5.0.18 web app and see the change (log level) in my logs without restarting Tomcat. My goal is to switch to debug level when I see "fishy behaviur" in the production deployed apps. How to achive this in best practice? -Borut - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Changing logging level at runtime
On Tue, May 19, 2009 at 10:18 AM, Borut Bolčina wrote: > I am sure Tapestry offers simpler solution (configuring some service) or at > least offers the infrastructure to implement behind the scenes periodic > reading of the log4j configuration. > Does it? No. Tapestry doesn't even depends on log4j, depending on SL4J instead. -- Thiago - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Changing logging level at runtime
I am sure Tapestry offers simpler solution (configuring some service) or at least offers the infrastructure to implement behind the scenes periodic reading of the log4j configuration. Does it? 2009/5/19 Alex Shneyderman > On Tue, May 19, 2009 at 2:33 PM, Borut Bolčina > wrote: > > Actually we do have this web app in cluster. > > in this case you will have to find out how to propagate level changes > to all the instances > of the cluster. > > > Are you saying that I should run this simple standalone java app to > change > > the log level of the web app? > > you could only if you share the class-loader with the app that you > want to see the > log levels adjusted - I believe this is default behavior in JBoss. > Most likely though > it will be simpler to simply embed the code into an existing application. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: Changing logging level at runtime
On Tue, May 19, 2009 at 2:33 PM, Borut Bolčina wrote: > Actually we do have this web app in cluster. in this case you will have to find out how to propagate level changes to all the instances of the cluster. > Are you saying that I should run this simple standalone java app to change > the log level of the web app? you could only if you share the class-loader with the app that you want to see the log levels adjusted - I believe this is default behavior in JBoss. Most likely though it will be simpler to simply embed the code into an existing application. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Changing logging level at runtime
Actually we do have this web app in cluster. Are you saying that I should run this simple standalone java app to change the log level of the web app? -Borut 2009/5/19 Alex Shneyderman > Write a little app to adjust debug levels on the fly. The basics of log4j > are: > > Logger lg = Logger.getLogger( "org.qi4j" ); > lg.setLevel( Level.INFO ); > > 2 things to watch out for: > > 1. Clusters. > 2. Classes are available in JVM only when loaded. So you will need a > listing of them before you deploy the app. I do this @ build time. > > - Alex > > PS: I wish I could publish this app ... but I can not. The basic ideas > are above. > > On Tue, May 19, 2009 at 1:39 PM, Borut Bolčina > wrote: > > Hi, > > > > I've been using log4j's configureAndWatch in some of my backend java > apps. I > > want to be able to change log4j.properties for my T5.0.18 web app and see > > the change (log level) in my logs without restarting Tomcat. > > > > My goal is to switch to debug level when I see "fishy behaviur" in the > > production deployed apps. > > > > How to achive this in best practice? > > > > -Borut > > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: Changing logging level at runtime
Write a little app to adjust debug levels on the fly. The basics of log4j are: Logger lg = Logger.getLogger( "org.qi4j" ); lg.setLevel( Level.INFO ); 2 things to watch out for: 1. Clusters. 2. Classes are available in JVM only when loaded. So you will need a listing of them before you deploy the app. I do this @ build time. - Alex PS: I wish I could publish this app ... but I can not. The basic ideas are above. On Tue, May 19, 2009 at 1:39 PM, Borut Bolčina wrote: > Hi, > > I've been using log4j's configureAndWatch in some of my backend java apps. I > want to be able to change log4j.properties for my T5.0.18 web app and see > the change (log level) in my logs without restarting Tomcat. > > My goal is to switch to debug level when I see "fishy behaviur" in the > production deployed apps. > > How to achive this in best practice? > > -Borut > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Changing logging level at runtime
Tomcat 2009/5/19 Joachim Van der Auwera > use JBoss? > > > Borut Bolčina wrote: > >> Hi, >> >> I've been using log4j's configureAndWatch in some of my backend java apps. >> I >> want to be able to change log4j.properties for my T5.0.18 web app and see >> the change (log level) in my logs without restarting Tomcat. >> >> My goal is to switch to debug level when I see "fishy behaviur" in the >> production deployed apps. >> >> How to achive this in best practice? >> >> -Borut >> >> >> > > > -- > Joachim Van der Auwera > PROGS bvba, progs.be > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: Changing logging level at runtime
use JBoss? Borut Bolčina wrote: Hi, I've been using log4j's configureAndWatch in some of my backend java apps. I want to be able to change log4j.properties for my T5.0.18 web app and see the change (log level) in my logs without restarting Tomcat. My goal is to switch to debug level when I see "fishy behaviur" in the production deployed apps. How to achive this in best practice? -Borut -- Joachim Van der Auwera PROGS bvba, progs.be - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Changing logging level at runtime
Hi, I've been using log4j's configureAndWatch in some of my backend java apps. I want to be able to change log4j.properties for my T5.0.18 web app and see the change (log level) in my logs without restarting Tomcat. My goal is to switch to debug level when I see "fishy behaviur" in the production deployed apps. How to achive this in best practice? -Borut