You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Eric Gravel <Er...@intervalintl.com> on 2003/11/24 21:04:01 UTC

How can I do a configuration reload?

Hi,
 
I'm trying to figure out how to do a reconfiguration of the log4j system
using xml config files.
I'd like to create a web interface that  would allow to change the
content of the xml file (either
physically on the disk or in memory only) and have it applied to the
current configuration loaded.
I can see needing to do this in production to turn on debugging
temporarly to troubleshoot an error.
 
Looking at Ceki's book on Log4J, it mentions on page 80-82 that you can
do this.  But it says 
that the configurator does NOT reset the existing configuration.  I'm
thinking this might be a problem
and would probably like to do a full flush on the configuration and have
everything reloaded from fresh.
One problem I can see with maybe doing this is that if I attempt to use
one of my logger (static instances)
while I'm reloading, I might have problems.  Uhm, actually what would
happen to those statics if I reload
the config and it creates a new object in memory?  My app would still
point to the old logger right? 
Would it still work?  Can log4j really remove it if I still hold a
static reference to it? GC won't be able to
release that object right?
 
 
"The crucial point to remember is that invoking any of the log4j
configurator does
not reset the previous configurator.  Reconfiguration has obviously some
effect on
the existing configuration.  In particular, all appenders of any logger
explicitly
mentioned in the new configuration will be closed and removed from the
logger.
However, loggers which are not mentioned in the new configuration remain
untouched.
All the more, appenders attached to such loggers remain attached after
reconfiguration."
 

Eric A. Gravel
Java Programmer/Analyst - Internet Development

Interval International
6262 Sunset Drive, PH-1
Miami, FL, 33143
<http://www.google.com/url?sa=X&oi=map&q=http://www.mapquest.com/maps/ma
p.adp%3Fcountry%3DUS%26address%3D6262%2BSunset%2BDr%2B%26city%3DMiami%26
state%3DFL%26zipcode%3D33143%26size=big> 
Office:  (305) 666-1861 x7315
Fax:      (305) 668-3409
Email:   eric.gravel@intervalintl.com


 


****CONFIDENTIALITY NOTE****
This e-mail and any attached documentation is intended only for the use of the individual or entity to which it is addressed and may contain information that is privileged, confidential, and exempt from disclosure. If any reader of this message is not the intended recipient you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately. Thank you.