• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Log4j runtime configuration issue in Weblogic

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic