Back to Nlog

NLog EventLog Target

src/NLog.WindowsEventLog/README.md

6.1.3886 B
Original Source

NLog EventLog Target

NLog EventLog Target writes to the Windows EventLog.

If having trouble with output, then check NLog InternalLogger for clues. See also Troubleshooting NLog

See the NLog Wiki for available options and examples.

Register Extension

NLog will only recognize type-alias eventlog when loading from NLog.config-file, if having added extension to NLog.config-file:

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

Alternative register from code using fluent configuration API:

csharp
LogManager.Setup().SetupExtensions(ext => {
   ext.RegisterTarget<NLog.Targets.EventLogTarget>();
});