Problem Logging to Windows EventLog

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem Logging to Windows EventLog

Alan
I'm trying to log to the windows application event log, but nothing is happening.

It is writing to my log file ok, but not to the windows event log.

Here's my config...  what am I doing wrong?


<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <targets>
        <target name="file" xsi:type="File" fileName="${basedir}/Nai.log"
          layout="${level:uppercase=true} ${longdate} ${logger} ${message} ${exception:format=message,stacktrace:separator=*}" />

        <target name="eventlog" xsi:type="EventLog"
          category="None" eventID="0" layout="${level:uppercase=true} ${longdate} ${logger} ${message}" machineName="." source="NAI" log="Application"/>     
    </targets>

    <rules>
        <logger name="*" minlevel="Trace" writeTo="file" />
        <logger name="*" minlevel="Trace" writeTo="eventlog" />
    </rules>
</nlog>
Reply | Threaded
Open this post in threaded view
|

Re: Problem Logging to Windows EventLog

Normann Aa, Nielsen
Category must be an integer (or omitted).