logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shireesh Thanneru <thann...@yahoo.com>
Subject Re: different levels for appenders
Date Fri, 07 Oct 2005 19:09:23 GMT
Yes, that is possible.
 
Here is how you can do that. Notice the <threshold> tag for the EventLogAppender. 
 


<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">

<file value="rolling-log-file.log" />

<appendToFile value="true" />

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

<maximumFileSize value="100KB" />

<maxSizeRollBackups value="10" />

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%date{ISO8601} %-5level %logger - %message%newline" />

</layout> 

</appender>

 

<appender name="EventLogAppender" type="log4net.Appender.EventLogAppender">

<layout type="log4net.Layout.PatternLayout">

<conversionPattern value="%date{ISO8601} %-5level %logger - %message%newline" />

</layout> 



<threshold value="ERROR" />

</appender>



<root>

<level value="ALL" />

<appender-ref ref="RollingFileAppender" />

<appender-ref ref="EventLogAppender" />

</root>

 

Thanks,

 

Shireesh Thanneru

jcmag <jcmag@yahoo.com> wrote:
Hello,

I would like to know if different appenders could have
different levels of logging.
In my project I have a RollingLogFile appender and an
EventLog appender; I would like to log all messages
(level=ALL) in the file and only ERROR messages in the
eventLog, is it possible ?

Thanks 

JC



__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Mime
View raw message