log4net中的SmtpAppender的TimeEvaluator不适用于Web项目

时间:2015-05-28 14:51:51

标签: asp.net log4net log4net-configuration log4net-appender

我有一个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打破了吗?

0 个答案:

没有答案