NLog configuration file

I often use NLog for diagnostic tracing in e.g. services. NLog is very much like log4net (log4j for .net) except that it is still being maintained, was written for .NET and features a very flexible end extensible logging framework. See also the post about interceptors. This is an example of a nlog.config I recently used for a service to get asynchronous logging and detailed exception information in a concise and structured format.

<?xml version="1.0" encoding="utf-8" ?>  
<nlog xmlns=""  
    <target name="asyncFile" xsi:type="AsyncWrapper">
      <target name="logfile" xsi:type="File" fileName="${environment:variable=ALLUSERSPROFILE}\MYSERVICE\Logs\${shortdate}.txt">
        <layout xsi:type="CSVLayout" delimiter="Tab">
          <column name="time" layout="${date:format=HH\:mm\:ss.ff}" />
          <column name="thread" layout="${threadid}" />
          <column name="level" layout="${level}" />
          <column name="idenity" layout="${windows-identity}" />
          <column name="message" layout="${message}" />
          <column name="exception" layout="${exception:format=type,message,method:maxInnerExceptionLevel=5;
innerFormat=shortType,message,method }" />  
    <logger name="*" minLevel="Debug" writeTo="logfile" />
Google @klinkby RSS feed  GitHub