I have configured log4net with a RollingLogFileAppender and a SmtpAppender, with the intention of logging the DEBUG level to the RollingLogFileAppender and FATAL only to the SmtpAppender:
<appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
<to value="test@test.com" />
<from value="test@test.com" />
<subject value="Fatal Error" />
<smtpHost value="smtp.test.com" />
<SMTPPort value="366"/>
<Username value="test@test.com"/>
<Password value="password"/>
<bufferSize value="1" />
<lossy value="true" />
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="FATAL"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
<appender-ref ref="SmtpAppender" />
</root>
This works perfectly until I increase the bufferSize. When I do this, all levels are sent via email and the log4net.Core.LevelEvaluator seems to be ignored. I have also tried using LevelRangeFilter and LevelMatchFilter but with these configured I seem to get no emails at all.