Skip to content
Michael Freidgeim edited this page Dec 31, 2013 · 16 revisions

Writes log message to the Event Log.

Supported in .NET and Mono ##Configuration Syntax

<targets>
  <target xsi:type="EventLog"
          name="String"
          layout="Layout"
          machineName="String"
          source="String"
          category="Layout"
          eventId="Layout"
          log="String" />
</targets>

Read more about using the [Configuration File](Configuration file). ##Parameters ###General Options name - Name of the target. ###Layout Options layout - Layout used to format log messages. Layout Required. Default: ${longdate}|${level:uppercase=true}|${logger}|${message} ###Event Log Options machineName - Name of the machine on which Event Log service is running. Default: .
source - Value to be used as the event Source. By default this is the friendly name of the current AppDomain.
category - Layout that renders event Category. The categories must be predefined for the specified source and needs to be numeric. Layout
eventId - Layout that renders event ID. Layout
log - Name of the Event Log to write to. This can be System, Application or any user-defined name. Default: Application ##Example

<target xsi:type="EventLog"
            name="eventlog"
            source="${appName}"
            layout="${message}${newline}${exception:format=ToString}"/>
Clone this wiki locally