File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

dynamically change log4j logging level

 
Jason Rodrigues
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you looking for something like this:

 
Jason Rodrigues
Greenhorn
Posts: 21
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Elie Hirschman
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic