title: How to roll the log file on startup in logback
body: <p>I would like to configure logback to do the following.</p>
  
  <ul>
  <li>Log to a file</li>
  <li>Roll the file when it reaches 50MB</li>
  <li>Only keep 7 days worth of logs</li>
  <li>On startup always generate a new file (do a roll)</li>
  </ul>
  
  <p>I have it all working except for the last item, startup roll.  Does anyone know how to achieve that?  Here's the config...</p>
  
  <pre class="lang-xml prettyprint-override"><code>  &lt;appender name="File" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
  
      &lt;layout class="ch.qos.logback.classic.PatternLayout"&gt;
        &lt;Pattern&gt;%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg \(%file:%line\)%n&lt;/Pattern&gt;
      &lt;/layout&gt;
  
      &lt;File&gt;server.log&lt;/File&gt;
  
      &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
        &lt;FileNamePattern&gt;server.%d{yyyy-MM-dd}.log&lt;/FileNamePattern&gt;
        &lt;!-- keep 7 days' worth of history --&gt;
        &lt;MaxHistory&gt;7&lt;/MaxHistory&gt;
  
        &lt;TimeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
          &lt;MaxFileSize&gt;50MB&lt;/MaxFileSize&gt;
        &lt;/TimeBasedFileNamingAndTriggeringPolicy&gt;
  
      &lt;/rollingPolicy&gt;
    &lt;/appender&gt;
  </code></pre>