【发布时间】:2018-08-08 22:33:12
【问题描述】:
我的项目有以下 nlog.config 文件。当我在本地调试时,它按预期工作,Hangfire 消息被过滤为仅显示 Warn 及以上。然而,在我们的登台服务器(IIS 8.5)上,nlog 似乎忽略了规则,只是将所有内容(包括 Info)记录到 elmah:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<extensions>
<add assembly="NLog.Elmah"/>
</extensions>
<targets>
<target xsi:type="Elmah" name="elmahWithLogLevelAsType" layout="${message}" LogLevelAsType="true"/>
</targets>
<rules>
<logger name="Hangfire.*" minlevel="Warn" writeTo="elmahWithLogLevelAsType" final="true" />
<logger name="*" minlevel="Info" writeTo="elmahWithLogLevelAsType" />
</rules>
</nlog>
即使我删除了 Hangfire.* 规则并将总括更改为 minlevel="Warn",它仍然会记录 Info 项。
【问题讨论】:
-
您确定您的 bin 文件夹中没有第二个 nlog.config 吗?
-
@Julian 不,肯定只有一个 nlog.config
标签: nlog elmah nlog-configuration