title: Change basedir in NLog Targets in runtime programmatically
body: <p>I have Windows Forms app NET 4.5 (VS 2013) using NLog.</p>
  
  <p>I have targets:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;target name="asyncFileLog" xsi:type="AsyncWrapper"&gt;
    &lt;target name="logfileTrace" xsi:type="File" fileName="${basedir}/logs/${shortdate}Trace.log" layout="${longdate} ${message}" lineEnding="Default"/&gt;
  &lt;/target&gt;
  
  &lt;target name="asyncFileError" xsi:type="AsyncWrapper"&gt;
    &lt;target name="logfileError" xsi:type="File" fileName="${basedir}/logs/${shortdate}Error.log" layout="${longdate} ${message} ${exception:format=tostring}"  lineEnding="Default"/&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p><code>LogManager.Configuration.AllTargets.ToList();</code> returns 4 items, not 2 items.</p>
  
  <p>I want change the path <strong>${basedir}/logs</strong> in runtime, programmatically</p>
  
  <p>I try this:</p>
  
  <pre><code>var rutaLogs = ConfigurationManager.AppSettings["RutaLog"];
  if (!Directory.Exists(rutaLogs)) return;
  
  var list = LogManager.Configuration.AllTargets.ToList();
  foreach (var target in list)
  {
      FileTarget fileTarget = null;
      var wrapperTarget = target as WrapperTargetBase;
  
      // Unwrap the target if necessary.
      if (wrapperTarget == null)
      {
          fileTarget = target as FileTarget;
      }
      else
      {
          fileTarget = wrapperTarget.WrappedTarget as FileTarget;
          continue;
      }
  
      var value = fileTarget.FileName.ToString();
      value = value.Replace("${basedir}/logs/", rutaLogs);
      fileTarget.FileName = value;
  }
  </code></pre>
  
  <p>Not generates anything.
  I try using <code>LogManager.ReconfigExistingLoggers();</code> too, but not working.</p>
  
  <p>Any suggestions?</p>