tags:

views:

601

answers:

3

how can i configure a log4j.properties with a rootlogger = debug, stdout, logfile
and org.apache.httpclient = debug which goes into the logfile but not the stdout?

raising the rootlogger to info is not acceptable as i have others package at the debug level.

A: 

Your could achieve this functionality by using filters on the different appenders. I think the LevelRangeFilter would be what you are looking for.

However I think filters can only be specified if your are using an xml file for configuration and are not supported when using a .properties file.

Wolfgang
you mean the appender threshold ?
zeroin23
+2  A: 

In the log4j.properties file, add the line

log4j.logger.org.apache.httpclient=DEBUG, logfile

to direct the org.apache.httpclient logger output to the logfile appender.

Also include the line

log4j.additivity.org.apache.httpclient=false

to prevent the org.apache.httpclient logger output going to the rootLogger's appenders.

Jim Huang
A: 

How to turn off the particular fileappender that means the log file should not be created. What is the method to do it?

Ankita