title: Log4Net Setup in a WPF app
body: <p>I can't believe i'm having to ask this but here goes ...</p>
  
  <p>I'm trying to setup log4net in a new WPF app and for some reason it's not creating the log file and logging anything, so here's the steps I've done so far ...</p>
  
  <p>After adding the latest version (v2.0.8.0) reference from nuget.</p>
  
  <p>In AssemblyInfo.cs:</p>
  
  <pre><code> [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
  </code></pre>
  
  <p>In app.config:</p>
  
  <pre><code>  &lt;configSections&gt;
      &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=2.0.8.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" /&gt;
    &lt;/configSections&gt;
    &lt;log4net configSource="Log4Net.config" /&gt;
  </code></pre>
  
  <p>In Log4Net.config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;log4net&gt;
    &lt;appender name="rollingLogFile" type="log4net.Appender.RollingFileAppender"&gt;
      &lt;file value="D:\Logs\WorkflowApp.log" /&gt;
      &lt;appendToFile value="true" /&gt;
      &lt;rollingStyle value="Size" /&gt;
      &lt;maxSizeRollBackups value="10" /&gt;
      &lt;maximumFileSize value="100KB" /&gt;
      &lt;staticLogFileName value="true" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%date [%thread] %-6level %logger - %message %exception%newline" /&gt;
      &lt;/layout&gt;
    &lt;/appender&gt;
    &lt;root&gt;
      &lt;level value="DEBUG" /&gt;
      &lt;appender-ref ref="rollingLogFile" /&gt;
    &lt;/root&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p>In App.xaml.cs:</p>
  
  <pre><code>ILog log = LogManager.GetLogger(typeof(App));
  
  protected override void OnStartup(StartupEventArgs e)
  {
      base.OnStartup(e);
      log.Debug("Initialising ...");
  }
  </code></pre>
  
  <p>As one last final "try it and see if it works" I added this to the above method ...</p>
  
  <pre><code>XmlConfigurator.Configure();
  </code></pre>
  
  <p>... still no long file created.</p>
  
  <p>So what did I miss?</p>
  
  <p>EDIT:</p>
  
  <p>So based on comments, I thought I should add this: </p>
  
  <p>I have seen questions &amp; answers like this ...
  <a href="https://stackoverflow.com/questions/17106559/using-log4net-to-write-to-different-loggers">Using log4net to write to different loggers</a></p>
  
  <p>... If I add something like this to my Log4Net.config ...</p>
  
  <pre><code>  &lt;logger name="File"&gt;
      &lt;level value="DEBUG" /&gt;
      &lt;appender-ref ref="rollingLogFile" /&gt;
    &lt;/logger&gt;
  </code></pre>
  
  <p>Then change my logger construction to ...</p>
  
  <pre><code>ILog log = LogManager.GetLogger("File");
  </code></pre>
  
  <p>... this however still results in nothing happening, no log file but no exceptions and the code appears to run fine other than the logging calls which appear to execute but with no results.</p>