aspose file tools
The moose likes Other Open Source Projects and the fly likes dynamically change log4j logging level Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply Bookmark "dynamically change log4j logging level" Watch "dynamically change log4j logging level" New topic
Author

dynamically change log4j logging level

Jason Rodrigues
Greenhorn

Joined: Oct 20, 2005
Posts: 21
Hi is it possible to change the logging levels of log4j without brining down the server ?
Do you have any suggestion what i could take a look at or if you have sample code i could look at .
we are using jdk 1.4.2
aprpeicate your thoughts
-reeve
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 8141
    
  52

Are you looking for something like this:



[My Blog] [JavaRanch Journal]
Jason Rodrigues
Greenhorn

Joined: Oct 20, 2005
Posts: 21
Well i need to do what you mentioned dynamically. That wont work for me. You must have noticed that each time you make a change to the configuration file, you have to restart your application. This can be a little bit cumbersome. I was wondering if there is a dyanmic way of changing the logging levels without restaring the server .
Gaurav Bhatia
Ranch Hand

Joined: Jan 01, 2007
Posts: 49
Using PropertyConfigurator.ConfigureAndWatch() you can enable log4j to watch any changes to the configuration file and apply those changes to the logging at runtime without any restart of the application.

Hope that helps
Gaurav


~Gaurav<br />SCJP5
Elie Hirschman
Ranch Hand

Joined: Dec 15, 2005
Posts: 37
I just came across this article, figured I would share:
http://springtips.blogspot.com/2007/07/changing-log4j-logging-levels.html
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: dynamically change log4j logging level
 
Similar Threads
Redirecting Exceptions Or Exceptions to our own log files
Logging info on server side
log4j : How to set append flase for backup files
confused between log4j and Jakarta Commons Logging
abt log file