I'm using NLog in my MVC Web Api application. I installed NLog using NuGet package manager and configured my log target in Nlog.conf file which got created.
<targets>
<target xsi:type="EventLog"
name="eventlog"
source="ImageService"
machineName="."
log="Application"
layout="${longdate}|${level}|${message}"/>
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="eventlog" />
</rules>
Then in registered a new event using powershell.
New-EventLog -Logname Application -Source ImageService
Now in C# code I'm doing following
Logger _log = LogManager.GetCurrentClassLogger();
_log.Info("Demo message);
But when I go to Event Viewer -> Windows Log -> Application and filter it based on source name ImageService it doesn't show any entry there.
If it is of any significance .The above logger code is written in separate Class library which is then referenced in the Web application and the log function is called.
Is there anything wrong with my target and rule configuration ?