Logging to sepecific event source using NLog

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Logging to sepecific event source using NLog

Novalis
I can able to log windows event source using NLog.

But what i want is to write a specific event source: such as : MyEventSource

My config is:

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <targets>

    <target name="eventlog" xsi:type="EventLog"  log="MyEventSource" />

  </targets>

  <rules>
    <logger name="*" minlevel="Trace" writeTo="eventlog" />
  </rules>
</nlog>

Well when i try to log anthing, MyEventSource is created but log message is written to general windows [7] applicantion event source not MyEventSource.