我无法使用 NLog 写入事件日志。我已经能够写入控制台和文件。我在 NLog 中打开了异常,但没有收到 NLog 的任何反馈。
这是我的 NLog.config:
<?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"
throwExceptions="true">
<targets>
<target name="console" xsi:type="Console" layout="${message}" />
<target xsi:type="EventLog" name="eventlog" layout="${message}" log="Application" source="aaaTest"/>
<target xsi:type="File" fileName="log.txt" name="file"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="eventlog,console,file" />
</rules>
</nlog>
在事件查看器中,我正在查看“事件查看器(本地)”>“Windows 日志”>“应用程序”。但是,我在日志中没有看到“aaaTest”(我定义的源)的实例。