title: Logback: One file with maximum file size
body: <p>my system support team needs <strong>one</strong> simple <strong>log-file</strong>, with a <strong>maximum size</strong> of 10MB. <strong>Older log-lines</strong> can be <strong>deleted</strong> when the file reaches 10MB. So roll out the oldest lines.</p>
  
  <p>What is a good appender for this?
  I have one <strong><em>appender</em></strong>, but this <strong><em>still created a second file</em></strong>, and then <strong><em>starts again with an empty new file</em></strong>. This is not what my support team wants.</p>
  
  <p><em>Help is appreciated.</em></p>
  
  <pre><code>&lt;configuration&gt;
      &lt;appender name="TEST" class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
          &lt;file&gt;${LOG_HOME}/test.log&lt;/file&gt;
          &lt;rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"&gt;
              &lt;fileNamePattern&gt;${LOG_HOME}/test.%i.log&lt;/fileNamePattern&gt;
              &lt;minIndex&gt;1&lt;/minIndex&gt;
              &lt;maxIndex&gt;1&lt;/maxIndex&gt;
          &lt;/rollingPolicy&gt;
          &lt;triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"&gt;
              &lt;maxFileSize&gt;10MB&lt;/maxFileSize&gt;
          &lt;/triggeringPolicy&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%date %-5level [%thread] - %mdc{loginName} - [%logger]- %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
  
    &lt;root level="DEBUG"&gt;
      &lt;appender-ref ref="FILE" /&gt;
    &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>