title: NLog Writing Log File to Incorrect Directory when Application Is Default Handler
body: <p>I've come across a weird issue and I wonder if it's configuration or a bug. I can't find anything online so here's the issue. My question is how can I write to the executable directory and not the launching directory.</p>
  
  <p>Steps to reproduce:</p>
  
  <ol>
  <li>Create an application with logging (<code>C:\Program Files\FooBar\FooBar.exe</code>)</li>
  <li>Make this application a default handler for a particular file type (<code>*.bar</code>)</li>
  <li>Launch the application by double clicking the a file of the particular file type (<code>C:\Desktop\foo.bar</code>)</li>
  <li>The log file will be written to the directory of the file, not the executing directory. (<code>C:\Desktop\log.txt</code> instead of <code>C:\Program Files\FooBar\log.txt</code>.)</li>
  </ol>
  
  <p>Am I doing something wrong? When I launch the application first and then load the file the logging occurs in the correct directory. My code and config is very simple:</p>
  
  <pre><code>public partial class Form1 : Form {
      private static Logger logger = LogManager.GetCurrentClassLogger();
  
      public Form1() {
          InitializeComponent();
          MessageBox.Show("Continue");
      }
  }
  </code></pre>
  
  <p>And the config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
    autoReload="true"
    throwExceptions="false"
    internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" &gt;
    &lt;targets&gt;
      &lt;target name="logfile" xsi:type="File" fileName="FooBar.txt" /&gt;
    &lt;/targets&gt;
    &lt;rules&gt;
      &lt;logger name="*" minlevel="Info" writeTo="logfile" /&gt;    
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>
  
  <p>I've put a debugger to see where <code>Assembly.GetExecutingAssmebly()</code> is located and it's in the correct place (<code>C:\Program Files\FooBar\foobar.exe</code>). So I'm not sure why NLog is writing a log to the directory with the file that launched the file and not the executable directory itself.</p>