Cassie Mod

Cassie Mod

  • NA
  • 488
  • 71.1k

log4net send several log emails instead of just one.

Feb 18 2016 3:54 AM
hi,
 
I have a logger implemented from log4net. Wich works fine. However, it doesn;t just send one email with all the log information. It send an email for each log message. The problem lies in the time between the log moments  ( a vew seconds). The system probebly thinks it is done logging so it send an email after that does do some more logging and email that again.
is There a way to implement a timespan or something. So i can say if you haven't logged anything for 3 minutes than send the email.
 
here is my config from log4net and it is about the EmailAppender:
 
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="c:\Log\RatingTribessCheck.Cmd" />
<staticLogFileName value="false" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="_yyyy.MM.dd.&quot;log&quot;" />
<maxSizeRollBackups value="10" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss,fff} %-5level - %message%newline" />
</layout>
</appender>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<target value="Console.Error" />
<mapping>
<level value="FATAL" />
<foreColor value="Red" />
<backColor value="White" />
</mapping>
<mapping>
<level value="ERROR" />
<foreColor value="Red, HighIntensity" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="Cyan" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="Green" />
</mapping>
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<appender name="EmailAppender" type="log4net.Appender.SmtpAppender">
<param name="Threshold" value="INFO" />
<subject value="Tribess Rating Error Report" />
<to value="[email protected]" />
<from value="TribessRatingChecker &lt;[email protected]&gt;" />
<smtpHost value="smtp-out.onexs.com" />
<bufferSize value="1000" />
<lossy value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{yyyy-MM-dd HH:mm:ss,fff} %-5level - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
</root>
<logger name="OneXS">
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="ColoredConsoleAppender" />
<appender-ref ref="EmailAppender" />
</logger>
</log4net>