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 <p.stavrini...@albourne.com> 
19/05/2009 14:40
Please respond to
"Tapestry users" <users@tapestry.apache.org>


To
Tapestry users <users@tapestry.apache.org>
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" <borut.bolc...@gmail.com>
To: "List Tapestry User" <users@tapestry.apache.org>
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.

Reply via email to