Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Log4j runtime configuration issue in Weblogic

 
kritika ram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using the configureAndWatch() method of DOMConfigurator to enable the periodic check of my application's log4j.xml file. It works fine in a 'stand-alone' mode, but when i deploy my web-app in weblogic, i need to restart my application every time i make some changes to log4j.xml.
Is weblogic caching the log4j.xml somewhere ?

Thanks in advance,
Kitty
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not think caching is the problem ? And even if it caches then on what basis ?
 
kritika ram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if it is not caching, then is it the watchdog thread problem ? According to log4j documentation:
http://logging.apache.org/log4j/docs/faq.html#2.2

3.6 Is there a way to get log4j to automatically reload a configuration file if it changes?

Yes. Both the DOMConfigurator and the PropertyConfigurator support automatic reloading through the configureAndWatch method. See the API documentation for more details.

Because the configureAndWatch launches a separate wathdog thread, and because there is no way to stop this thread in log4j 1.2, the configureAndWatch method is unsafe for use in J2EE envrironments where applications are recycled.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kritika ram:

3.6 Is there a way to get log4j to automatically reload a configuration file if it changes?


I do not think that there is any way possible of doing so as then there has be some thread looking whether the configuration file has changed or not.Probably that might be the reason that they have introduced something like wait and watch.
But its possible to trigger the loading of configuration again and again.
You can have a mbean in your application and trigger it whenever you change the configuration file.
 
kritika ram
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply, could you give me some idea or some links for configuring mbeans, I have not worked much with them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic