I have a C# console application trying to log events to my custom event log using NLog.
However, the log events are always written to the Application log and not to the one I have already configured. I am using NLog version 4.4.0. What am I missing here?
Here is the configuration in my App.config:
<code>
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true" internalLogToConsole="true" internalLogLevel="Trace">
<targets>
<target xsi:type="EventLog" name="eventLog" layout="${longdate}|${message}" source="MyCustomLogSource" log="MyCustomLog" machineName="." />
<!-- note: source is a string in NLog before 4.0 -->
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="eventLog" />
</rules>
</nlog>
</configuration>
</code>