Async logging issue

1 message Options
Embed this post
Permalink
mbargar

Async logging issue

Reply Threaded More More options
Print post
Permalink
Logging using the <targets async=true> stop from writing to a file. If I remove that option, it logs just fine.
I am using my App.Config file to configure NLog. Here is my config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
  </configSections>

  <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         autoReload="true"
         throwExceptions="true"
         internalLogFile="nlog.log"
         internalLogLevel="Trace">
    <targets async="true">      
        <target name="file" xsi:type="File" fileName="${basedir}/logs/${level}.txt" />      
    </targets>
    <rules>
      <logger name="*" minlevel="Trace" writeTo="file" />
    </rules>
  </nlog>
</configuration>

Also here my call to the logger in my code:
private static Logger logger = LogManager.GetCurrentClassLogger();


Any ideas why this does not work? I have tried all the possible ways to enable Async logging, and I still cannot get it to log.