logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Gravel" <Eric.Gra...@intervalintl.com>
Subject How can I do a configuration reload?
Date Mon, 24 Nov 2003 20:04:01 GMT
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
mentioned in the new configuration will be closed and removed from the
However, loggers which are not mentioned in the new configuration remain
All the more, appenders attached to such loggers remain attached after

Eric A. Gravel
Java Programmer/Analyst - Internet Development

Interval International
6262 Sunset Drive, PH-1
Miami, FL, 33143
Office:  (305) 666-1861 x7315
Fax:      (305) 668-3409
Email:   eric.gravel@intervalintl.com


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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message