Does anyone have a working configuration of a log4net smtp appender to send error logs to an email address? I've setup a separate appender for my namespace and only want to receive those logs, so want to setup an smtp appender for only errors on my namespace.
Also, i'd love if it could use the smtp details specified in my web.config instead of entering them again in the log4net.config file.
Did you get to the bottom of this? I am looking to do something similar. I added smtp appender and that works. I added filter that has stopped smtp logging completly my config looks like
log4net email logs
Does anyone have a working configuration of a log4net smtp appender to send error logs to an email address? I've setup a separate appender for my namespace and only want to receive those logs, so want to setup an smtp appender for only errors on my namespace.
Also, i'd love if it could use the smtp details specified in my web.config instead of entering them again in the log4net.config file.
Greg,
Did you get to the bottom of this? I am looking to do something similar. I added smtp appender and that works. I added filter that has stopped smtp logging completly my config looks like
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value="xxxx" />
<from value="xxxxx" />
<subject value="Info graphic error" />
<smtpHost value="localhost" />
<bufferSize value="512" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="ERROR"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%newline%date [%thread] %-5level %logger [%property{NDC}] - %message%newline%newline%newline" />
</layout>
<filter type="log4net.Filter.LoggerMatchFilter">
<loggerToMatch value="MyProject.BusinessLogic.Helpers.RazorHelper" />
</filter>
<filter type="log4net.Filter.DenyAllFilter" />
</appender>
Note the xxxx is me just hiding actual values ;-}
Regards
Ismail
is working on a reply...