How can I avoid windows-complaining about missing descriptions for event ids when logging using NLog. When I use:
<target xsi:type="EventLog"
name="eventLog"
layout="${message}"
machineName="."
source="MyApp"
log="Application" />
and
<rules>
<logger name="*" minlevel="Debug" writeTo="eventLog" />
</rules>
the entry will appear in the log. But Windows complains about missing description for the event id "0" which is right.
Do I have to do things like pointed out here to get a clean logging?
I know it's an old post, but the configuration should be
<target xsi:type="EventLog"
name="eventLog"
layout="${message}"
machineName="."
source="MyApp"
log="Application"
eventId="${event-properties:EventID:whenEmpty=0}" />
and
<rules>
<logger name="*" minlevel="Debug" writeTo="eventLog" />
</rules>
See also: https://github.com/NLog/NLog/wiki/EventLog-target
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With