You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bender Heri <hb...@ergonomics.ch> on 2010/10/21 18:25:58 UTC

RE: [SCL-4] Is it possible to configure different log levels for the same appender based on what logger it is coming from?

One possibility I see:
Write an own Filter which is attached to the root logger's Apender and filter out the messages which you do not want.
Heri

> -----Original Message-----
> From: Adam Creeger [mailto:adamcreeger@gmail.com]
> Sent: Wednesday, October 20, 2010 11:23 PM
> To: log4j-user@logging.apache.org
> Subject: [SCL-4] Is it possible to configure different log levels for the same appender based on what
> logger it is coming from?
> 
> Hello all,
> 
> I have a question regarding how I might configure Log4J to support the
> following scenario:
> 
> The root logger has an appender (let's call this Appender Z) with a
> threshold of INFO. There is some important "info" messages that get logged
> to that root logger, so we can't set the threshold any higher...
> 
> Logger A has some verbose "info" logging that we wish to log to a separate
> appender (Appender Y). We want Logger A's "warn" and "error" messages to
> appear in the root logger, but not Logger A's "info" messages. It is totally
> fine for Logger A's "warn" and "error" messages to appear in Appender Y.
> 
> If I set additivity to false on Logger A, none of its "warn" or "error"
> messages will make it to Appender Z. If I leave additivity as true, all of
> its "info" messages will appear in Appender Z, which is not what we want.
> 
> Is there something I'm missing here?
> 
> Thanks!
> 
> Adam

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