title: Log4net creates new file with old date
body: <p>I implemented Console application that can run as Windows service (very similar to <a href="https://stackoverflow.com/questions/7764088/net-console-application-as-windows-service">.NET console application as Windows service</a>).</p>
  
  <ul>
  <li>.NET framework 4</li>
  <li>log4net 2.0.8</li>
  </ul>
  
  <p>This is log4net config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;log4net&gt;
  
    &lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt;
      &lt;file value="Log\App_%date{yyyy-MM-dd}.log" type="log4net.Util.PatternString" /&gt;
      &lt;appendToFile value="true" /&gt;
      &lt;param name="maxSizeRollBackups" value="5" /&gt;
      &lt;rollingStyle value="Composite" /&gt;
      &lt;datePattern value="yyyy-MM-dd" /&gt;
      &lt;filter type="log4net.Filter.LevelRangeFilter"&gt;
        &lt;acceptOnMatch value="true" /&gt;
      &lt;/filter&gt;
      &lt;lockingModel type="log4net.Appender.FileAppender+MinimalLock" /&gt;
      &lt;layout type="log4net.Layout.PatternLayout"&gt;
        &lt;conversionPattern value="%date [%-3thread] %-5level %logger - %message%newline" /&gt;
      &lt;/layout&gt;
    &lt;/appender&gt;
  
    &lt;root&gt;
      &lt;level value="ALL" /&gt;
      &lt;appender-ref ref="RollingLogFileAppender" /&gt;
    &lt;/root&gt;
  &lt;/log4net&gt;
  </code></pre>
  
  <p>The very first line in <code>Main(string[] args)</code> is log4net initialization:</p>
  
  <pre><code>XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "log4net.config"));
  </code></pre>
  
  <p>Logger is initialized at the top of <code>Program</code> class like this:</p>
  
  <pre><code>private static readonly ILog _log = LogManager.GetLogger(typeof(Program));
  </code></pre>
  
  <p>When service is started/restarted or console application is ran manually, log file is created with correct filename, e.g. <em>App_2017-11-29.log</em>. However, if I leave windows service running over night, at midnight new file with initial date is created and old file is appended yesterdays date. So for example, if I start service today, and leave it running for 3 days, this will be in log file</p>
  
  <ul>
  <li>App_2017-11-29.log (current log file)</li>
  <li>App_2017-11-29.log2017-12-01</li>
  <li>App_2017-11-29.log2017-11-30</li>
  <li>App_2017-11-29.log2017-11-29</li>
  </ul>
  
  <p>Any idea why this is happening?</p>