I asked (in the developer forum) how to turn off logging from the configuration file 
and Ceki kindly replied as below (basically saying to set log4j.threshold=OFF). This 
doesn't appear to have any effect. I'm using log4j 1.1.3.

Perhaps there are some other problems in my configuration file (below).

log4j.rootCategory=DEBUG, A1
log4j.threshold=OFF
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%p - %-16c - %m%n

I tried the log4j.threshold=OFF in various places. 

Also, surprised to see that if I set log4j.rootCategory=INFO, A1 this suppresses some 
(but not all) my INFO trace. This surprised me a) because I thought this statement 
meant "please show me all INFO trace" and b) because I can't see any obvious 
difference between the statements which still come out and those which do not.

I'm going to try the XML configuration to see if that helps, but any ideas on the 
above greatly appreciated!
Thanks
Rob Henley

----- Original Message ----- 
From: "Ceki Gülcü" <[EMAIL PROTECTED]>
To: "Log4J Developers List" <[EMAIL PROTECTED]>
Sent: Monday, May 20, 2002 4:01 PM
Subject: Re: turn off logging

You can set the threshold of an entire logger hierarchy to OFF

Example in properties (key=value) format:

log4j.rootLogger=DEBUG, CON
log4j.appender.CON=org.apache.log4j.ConsoleAppender
log4j.appender.CON.layout=org.apache.log4j.SimpleLayout

# Turn all logging OFF for all loggers regardless of the logger.
log4j.threshold=OFF

You can achieve the same in In XML format:

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

<log4j:configuration threshold="OFF"
                       xmlns:log4j='http://jakarta.apache.org/log4j/'>

   <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
     <layout class="org.apache.log4j.SimpleLayout"/>
   </appender>

   <root>
     <level value="DEBUG" />
     <appender-ref ref="STDOUT" />
   </root>
</log4j:configuration>

The important attribute is [threshold="OFF"]

HTH, Ceki

ps: By the way, this is the wrong forum. Your question should have been 
asked on the
log4j-user list.


Reply via email to