我有一个ASP.NET Web应用程序,它使用log4net登录各种appender。我已成功添加SmtpAppender
LevelEvaluator
,并可以通过此邮件发送电子邮件;但如果我用TimeEvaluator
替换它,我就无法发送电子邮件。
我使用LevelEvaluator
的appender看起来像这样(这是有效的):
<appender name="EmailErrorAppender" type="log4net.Appender.SmtpAppender">
<to value="to@myemail" />
<from value="from@myemail" />
<subject value="Alert Subject" />
<smtpHost value="mymailhost" />
<bufferSize value="50" />
<lossy value="true" />
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<levelMax value="FATAL" />
</filter>
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="ERROR"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger%newline%newline" />
</layout>
</appender>
TimeEvaluator
的有问题的appender看起来像这样(这不起作用):
<appender name="EmailErrorAppender" type="log4net.Appender.SmtpAppender">
<to value="to@myemail" />
<from value="from@myemail" />
<subject value="Alert Subject" />
<smtpHost value="mymailhost" />
<bufferSize value="50" />
<lossy value="true" />
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<levelMax value="FATAL" />
</filter>
<evaluator type="log4net.Core.TimeEvaluator">
<interval value="30"/>
</evaluator>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger%newline%newline" />
</layout>
</appender>
我已经检查了log4net的内部调试,并说它正在加载它。
我很感激任何帮助 - 在ASP.NET网络环境中被TimeEvaluator
打破了吗?