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 Nicko Cadell <ni...@neoworks.com> on 2006/02/28 19:35:00 UTC

RE: Is it possible to have in the same logger different appender depending of the level?

Yes you can do this by referencing both (or more) appenders from the logger and setting a <threshold> on the appender itself, for example:

<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
	<threshold value="INFO" />
	...
</appender>

<appender name="FileAppender" type="log4net.Appender.FileAppender">
	<threshold value="DEBUG" />
	...
</appender>

<root>
	<appender-ref ref="ConsoleAppender" />
	<appender-ref ref="FileAppender" />
</root> 

Cheers,
Nicko

> -----Original Message-----
> From: Jose Antonio Cortijo Solera [mailto:joseacs@tempe.es] 
> Sent: 10 February 2006 11:16
> To: log4net-user@logging.apache.org
> Subject: Is it possible to have in the same logger different 
> appender depending of the level?
> 
> log4net-user @logging.apache.org
> 
> Hi,
> 
>  
> 
> I am pretty newbie using log4net and I would like to have for 
> a asp.net page a rolling file appender for the debug log 
> statement and other smtp appender for error logs statements.
> 
> Is it possible to achieve this behaviour?
> 
>  
> 
> Thanks in advance. 
> 
>  
> 
> Jose Antonio Cortijo Solera
> 
> Dpto. de Informática
> 
> INDITEX TEMPE
> 
> mailto:joseacs@tempe.es <ma...@tempe.es> 
> 
> Tlfno. 966657500 Ext. 40969
> 
>  
> 
>