Try this...

log4j.appender.CONSOLE.Threshold=WARN
log4j.rootLogger=WARN, CONSOLE, FILE
log4j.logger.com.myapp=INFO


Jake

On Mon, 8 Jun 2009 14:45:10 -0400
 Bai Shen <baishen.li...@gmail.com> wrote:
Okay, that sort of worked.  This was how I had my log4j.properties setup.

log4j.rootLogger=WARN, CONSOLE, FILE
log4j.logger.com.myapp=INFO, FILE
log4j.additivity.com.myapp=false

So I got rid of the additivity line and replaced it with the threshold
line.  Now I'm getting double outputs to the file from the loggers.  I want
all things INFO or higher from my app to be logged in the file only.  I want
everything WARN or higher to be logged in both the console and the file.

And why does the threshold work?  Isn't that what the first argument after
the = is for?

On Fri, Jun 5, 2009 at 5:02 PM, Matt Brown <matt.br...@citrixonline.com>wrote:

You can try adding a threshold to the console appender:

log4j.appender.CONSOLE.threshold = WARN

This should tell the console appender to ignore any log messages it might
receive below the WARN level.



-----Original Message-----
From: Bai Shen [mailto:baishen.li...@gmail.com]
Sent: Friday, June 05, 2009 2:09 PM
To: log4j-user@logging.apache.org
Subject: Logging to console and file at different levels

I have a web service using Axis and running on Tomcat.  I'm using slf4j
piping to log4j.  I have the root logger set to WARN and to output to a file
and the console.  I also have a logger setup for just my application set to
INFO logging to the file.  I had to turn off addivity in order to get it to
not log to the console.

What I'd like to do is have my application still log any WARN messages in
the console as well as the file.  But I don't want any of the INFO messages
in the console.  How do I configure my setup to do that?

TIA.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to