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>