logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Smith <psm...@aconex.com>
Subject Re: Production configuration
Date Wed, 07 Nov 2007 20:37:55 GMT

On 08/11/2007, at 2:18 AM, Phillip Mills wrote:

> Thanks, I'll try.  I hadn't discovered that as an option.

actually the most efficient way is to get the LoggerRepository object  
and set that threshold to OFF.  When deciding whether appenders get to  
see an event, the LoggerRepository's threshold is checked first,  
before the logger hierarchy is computed for levels.

Programitically it would be:


> (Follow-up: Is there complete documentation or a DTD for log4j XML
> configuration available?)

For the XML configuration stanza, it would look like this:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" threshold="OFF"

Notice the threshold parameter? This would be useful in your  
environment because you could configure the log4j.xml file to specify  
everything you'd like to log _if_ logging was enabled (start with  
threshold=off) and then at runtime edit the file to activate the  top  
level threshold to, say, DEBUG, allowing the actual logger levels  
defined in the xml config to be evaluated.  You'd need to set up a  
FileWatchdog to monitor the log4j.xml so that when modified, log4j  
reconfigures itself.

The DTD and related docs are here:


See the super class for most of the real information.

the dtd link seems broken from this page, but here's the link:




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