[logback-user] RollingFileAppender with SizeBasedTriggeringPolicy keeps writing to rotated file

Rolando Segura rolandosegura at gmail.com
Thu May 23 00:03:06 CEST 2013


 Hi I have an RollingFileAppender with a triggering policy of rotating by
size when the log reaches 32MB and a maxIndex of 1, configuration below.
It happens that after rotation logback keeps writing to both files. Is this
expected? My understanding from documentation is that it will stop writing
to the current log, rename it and starts writing a to a new file with the
name of the File parameter.

I'd appreciate your clarification if I'm not understanding well the
RollingFileAppender and SizeBasedTriggering behavior.

Thanks,
Rolando



<appender name="lognocrlf"
class="ch.qos.logback.core.rolling.RollingFileAppender">
    <File>/opt/log/file.nocrlf.log</File>
    <encoder>
      <pattern>[%d{ISO8601}] %5p [%t] \(%logger\) -
%replace(%m){'\r?\n',''}%n</pattern>
    </encoder>
    <rollingPolicy
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <maxIndex>1</maxIndex>
      <FileNamePattern>/opt/log/file.nocrlf.log.%i</FileNamePattern>
    </rollingPolicy>
    <triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <MaxFileSize>32MB</MaxFileSize>
    </triggeringPolicy>
  </appender>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130522/f85b1f56/attachment.html>


More information about the Logback-user mailing list