Forums Register Login

Log4j runtime configuration issue in Weblogic

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
I do not think caching is the problem ? And even if it caches then on what basis ?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
Thanks for your reply, could you give me some idea or some links for configuring mbeans, I have not worked much with them.
This tiny ad will self destruct in five seconds.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2427 times.
Similar Threads
log4j: log4j:WARN No appenders could be found for logger (org.apache.commons.digester
log4j not logging
Log4J issues
How to read log4j.xml file path at runtime without hardcoding the path in Java Class...?
Log4j with xml configuration under weblogic 9.2
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:07:04.