我在使用 Nlog 的 C# 应用程序中有以下代码。带有“调试”的消息会被记录,但“信息”不会。我假设由于 app.config 中的 minLevel 设置为“Debug”,“Info”消息也会被记录,因为 Debug 的优先级高于“Info”。但是他们没有被记录。我哪里错了?
谢谢。
if (logger.IsDebugEnabled) logger.Debug(logMessage) else if (logger.IsInfoEnabled)log.Info(logMessage);
这是 app.config 设置
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File" fileName="E:/Logoutputs/Remissol-Nlog.txt" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>