aspose file tools*
The moose likes Other Open Source Projects and the fly likes Log4j runtime configuration issue in Weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Log4j runtime configuration issue in Weblogic" Watch "Log4j runtime configuration issue in Weblogic" New topic
Author

Log4j runtime configuration issue in Weblogic

kritika ram
Greenhorn

Joined: Aug 25, 2006
Posts: 12
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

Joined: Nov 29, 2005
Posts: 2308
I do not think caching is the problem ? And even if it caches then on what basis ?


Rahul Bhattacharjee
LinkedIn - Blog
kritika ram
Greenhorn

Joined: Aug 25, 2006
Posts: 12
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

Joined: Nov 29, 2005
Posts: 2308
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

Joined: Aug 25, 2006
Posts: 12
Thanks for your reply, could you give me some idea or some links for configuring mbeans, I have not worked much with them.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Log4j runtime configuration issue in Weblogic