You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Schwartz Adi <as...@elta.co.il> on 2007/03/22 09:22:32 UTC

logging from diffrent levels to diffrent appenders

Hello,
Is there a way, on the same logger, 
to log Error level to the console and  Warning(and above) level to a
file?
 
Thanks,
Adi


 The information contained in this communication is proprietary to Israel Aerospace Industries Ltd. 
and/or third parties, may contain confidential or privileged information, and is intended only for 
the use of the intended addressee thereof. If you are not the intended addressee, please be aware 
that any use, disclosure, distribution and/or copying of this communication is strictly prohibited.
If you receive this communication in error, please notify the sender immediately and delete it from 
your computer. Thank you. 


This message is processed by the PrivaWall Email Security Server. 



RE: logging from diffrent levels to diffrent appenders

Posted by ni...@apache.org.
Adi,

The logger can only be configured with 1 level which is used to filter
all messages. If you want to do anything more complicated then you need
to do it on the appenders themselves.

Appenders can have a threshold level that restricts the events that they
receive. This applies to all events from all loggers, but can be easily
used to setup a situation where all logging goes to a file, but only
errors and above go to the console.

If you need finer control than that you can use filters on the appenders
to check the level and the logger and either allow or deny the event. If
the built-in filters don't provide you with enough control you can
always write your own.

For more details on filters see:

http://logging.apache.org/log4net/release/manual/introduction.html#filte
rs
http://logging.apache.org/log4net/release/manual/configuration.html#filt
ers

Cheers,
Nicko

> -----Original Message-----
> From: Schwartz Adi [mailto:aschwartz@elta.co.il] 
> Sent: 22 March 2007 08:23
> To: log4net-user@logging.apache.org
> Subject: logging from diffrent levels to diffrent appenders
> 
> Hello,
> Is there a way, on the same logger,
> to log Error level to the console and  Warning(and above) 
> level to a file?
>  
> Thanks,
> Adi
> 
> 
> The information contained in this communication is 
> proprietary to Israel Aerospace Industries Ltd. 
> and/or third parties, may contain confidential or privileged 
> information, and is intended only for the use of the intended 
> addressee thereof. If you are not the intended addressee, 
> please be aware that any use, disclosure, distribution and/or 
> copying of this communication is strictly prohibited.
> If you receive this communication in error, please notify the 
> sender immediately and delete it from 
> your computer. Thank you.	
> 
> 
> This message is processed by the PrivaWall Email Security Server. 
> 
>