NLog not writing to eventlog .NET Core 2.1

陌路散爱 提交于 2019-12-06 16:05:31

For me the answer was adding "NLog.WindowsEventLog" assembly to the extensions area to nlog.config:

<extensions>
   <add assembly="NLog.WindowsEventLog" />
</extensions>

I had the default: "NLog.Web.AspNetCore".

Rolf Kristensen

.Net Core is a subset of the .Net Framework, and doesn't include things like Windows EventLog (as this doesn't exist on other non-Windows-devices).

You should make sure to check the platform support documentation first:

https://github.com/NLog/NLog/wiki/platform-support

There you will see that a special Nuget-package has been created for .Net Core-applications on the Windows platform:

https://www.nuget.org/packages/NLog.WindowsEventLog/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!