• 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 - configureAndWatch

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Day All !!
Thanks for the replies with regards configuring Log4J. I've chosen to use a xml config file (after doing some experimenting with properties files). Hmm....I should probably add that to my last post.
I've encountered a new hiccup. My code uses the DOMConfigurator in the following fashion:
DOMConfigurator.configureAndWatch("log4j.xml");
Here's the hiccup, when I make changes to my file, they are not picked-up until I re-start Tomcat.
Any ideas ? I've done a little research, and haven't found anything related to bugs on this. Is there something I'm missing ?
S
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, according to log4j faq, this method is unsafe in J2EE environment. There is a topic that explains how to resolve this problem by your own:

http://www.alegsa.com.ar/Visitas/index23/Alternative%20to%20change%20log4j%20logging%20level%20at%20runtime.php

Here is the quote from this topic:


In a J2EE application server, servlets may be unloaded at any time. You
know that before that happens, the destroy() method is called, so you can
clean up any background threads.

The Log4J thread that does that however, is not cleaned up. Or at least
there is no guarantee of that. Thus it is unsafe.

However, you can use the configuration methods of Log4J also to
REconfigure: start that background thread to signal changes in the logging
configuration yourself. You can then make sure that background thread is
stopped the the servlet initiating it is destroyed.



Best regards...

Mert
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic