I have a .net 4.6.2 web api project with NLog logging with only one target of type file.
The issue is that logging is behaving differently. Instead of appending logs to the same file continuously only first exception is getting logged and then nothing happens. I tried changing the layout of the generated file name so that I will get separate files on for each exception but still - files got generated only once, for only one exception (first exception after running the web api in debug mode or after mounting it in IIS).
This is how NLog sections looks like in my web.config
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog" />
</configSections>
<nlog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff} ${level}: ${message} ${exception:format=tostring}" fileName=".\Logs\test_${shortdate}.log" />
</targets>
<rules>
<logger name="*" minlevel="Error" writeTo="logfile" />
</rules>
</nlog>
Have you had such an experience ? How did you deal with it ?