NLog and Unit Testing
<p>I am using NLog for my logger. Everything works fine when logging when I run an .exe, or even debug through Visual Studio, NLog will still write to the file. </p>

<p>But, if I run an object that calls the logger through a Unit test, the file is created but it is empty. Is there an extra setting/rule I need to add to the config to have NLog write to files under unit tests?</p>

<p>I could mock NLog for this and not have log dumps, but I'd like to see if I can get this to work before I decide to just mock NLog. Even though this is only happening in unit tests and is working otherwise, here is my config and code for logging. I left out the filenames.</p>

<pre><code>public static void Info(string app, string m)  =&gt; EngineLogger.Logger.Info($"{app} : {m}");



&lt;targets&gt;
    &lt;target name="infoFile"
            xsi:type="File"
            layout="${date:format=yyyy-MM-dd HH\:mm\:ss} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}"
            fileName="leftoutForQuestion"
            keepFileOpen="false"
            encoding="iso-8859-2" /&gt;
    &lt;target name="errorFile"
            xsi:type="File"
            layout="${date:format=yyyy-MM-dd HH\:mm\:ss} ${pad:padding=5:inner=${level:uppercase=true}} ${logger} ${message}"
            fileName="leftOutForQuestion"
            keepFileOpen="false"
            encoding="iso-8859-2" /&gt;
  &lt;/targets&gt;
  &lt;rules&gt;
    &lt;logger name="*" minlevel="Debug" maxlevel="Info" writeTo="infoFile" /&gt;
    &lt;logger name="*" minlevel="Warn" maxlevel="Fatal" writeTo="errorFile" /&gt;
  &lt;/rules&gt;
</code></pre>

<p>Here is the error from internal log:</p>

<pre><code>Error Error has been raised. Exception: System.Runtime.InteropServices.COMException (0x800700A1): The specified path is invalid. (Exception from HRESULT: 0x800700A1)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at NLog.Internal.FileAppenders.BaseFileAppender.WindowsCreateFile(String fileName, Boolean allowFileSharedWriting)
   at NLog.Internal.FileAppenders.BaseFileAppender.TryCreateFileStream(Boolean allowFileSharedWriting)
   at NLog.Internal.FileAppenders.BaseFileAppender.CreateFileStream(Boolean allowFileSharedWriting)
   at NLog.Internal.FileAppenders.RetryingMultiProcessFileAppender.Write(Byte[] bytes)
   at NLog.Targets.FileTarget.WriteToFile(String fileName, LogEventInfo logEvent, Byte[] bytes, Boolean justData)
   at NLog.Targets.FileTarget.ProcessLogEvent(LogEventInfo logEvent, String fileName, Byte[] bytesToWrite)
   at NLog.Targets.FileTarget.Write(LogEventInfo logEvent)
   at NLog.Targets.Target.Write(AsyncLogEventInfo logEvent)
</code></pre>