Thursday, July 18, 2013

log4net email alerts

An appender such as the one below will allow one to send email alerts from log4net.

<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
   <authentication value="Basic" />
   <to value="tomjaeschke@tomjaeschke.com,fevercheese@gmail.com" />
   <from value="tjaeschke@example.com" />
   <username value="tjaeschke@example.com" />
   <password value="b0x1ng_Helena" />
   <subject value="Notification" />
   <smtpHost value="smtp.example.com" />
   <bufferSize value="1" />
   <lossy value="true" />
   <evaluator type="log4net.Core.LevelEvaluator">
      <threshold value="FATAL"/>
   </evaluator>
   <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="Something went wrong." />
   </layout>
</appender>

No comments:

Post a Comment