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: SmtpAppender and EventLogAppender
Date Fri, 09 Sep 2005 14:19:17 GMT
Try using the applying the following level filter to achieve that:

<filter type="log4net.Filter.LevelRangeFilter">
    <levelMin value="ERROR" />
    <levelMax value="FATAL" />
</filter>

Use the above filter filter element in your SmtpAppender configuration
and see.

Thanks,

Shireesh Thanneru

--- Farid LAOUFI <faridlaoufi@gmail.com> wrote:

> Hello,
> I'm doing a windows service which uses a SmtpAppender and an 
> EventLogAppender. The EventLogAppender logs all messages which level
> is 
> greater or equal to DEBUG, the SmtpAppender all messages which level
> is 
> greater or equal to ERROR. Now if I try this :
> 
> ILog logger = LogManager.GetLogger(this.GetType());
> logger.Info("Info 1");
> logger.Info("Info 2");
> logger.Error("ERROR !!!!!!!");
> 
> I receive a mail message which contains :
> 
> Info 1
> Info 2
> ERROR !!!!!!!
> 
> but I'd like only :
> 
> ERROR !!!!!!!
> 
> Can you help me please ? Here a part of my App.config :
> 
> <!-- Informations requises par log4net. -->
> <log4net>
> 
> <appender name="EventLogAppender"
> type="log4net.Appender.EventLogAppender" >
> <applicationName value="Serveur AP+" />
> <logName value="APPlus" />
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%message%newline%exception" />
> </layout>
> </appender>
> 
> <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
> <to value="*************" /> <!-- Liste des adresses e-mail
> (séparateur : 
> point-virgule) auxquelles seront envoyées les erreurs survenues. -->
> <from value="*************" />
> <subject value="[AP+] Une erreur est survenue" />
> <smtpHost value="*************" />
> <bufferSize value="512" />
> <lossy value="false" />
> <evaluator type="log4net.Core.LevelEvaluator">
> <threshold value="ERROR"/>
> </evaluator>
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%message%newline%exception" />
> </layout>
> </appender>
> 
> <root>
> <level value="DEBUG" />
> <appender-ref ref="EventLogAppender" />
> <appender-ref ref="SmtpAppender" />
> </root>
> 
> <!-- Ceci permet de désactiver le logging des messages provenant de 
> NHibernate. -->
> <logger name="NHibernate">
> <level value="OFF" />
> </logger>
> 
> </log4net>
> 


Mime
View raw message