Skip to main content
3 of 5
deleted 339 characters in body
Jonathan Williams
  • 14.5k
  • 1
  • 26
  • 59

[UPDATED]

The following XML is also given on the logback site. This uses the RollingFileAppender suggests that the 'maxFileSize' element needs to be inside a 'triggeringPolicy':

<configuration>
  <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>test.log</file>

    <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
      <fileNamePattern>tests.%i.log.zip</fileNamePattern>
      <minIndex>1</minIndex>
      <maxIndex>3</maxIndex>
    </rollingPolicy>

    <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
      <maxFileSize>5MB</maxFileSize>
    </triggeringPolicy>
    <encoder>
      <pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
    </encoder>
  </appender>
        
  <root level="DEBUG">
    <appender-ref ref="FILE" />
  </root>
</configuration>

The following information is also given on the site too:

Specified number is not in proper int form, or not expected format.

When you specify the MaxFileSize to be used by the SizeBasedRollingPolicy, logback expects a rather precise format:

The number has to be an integer You can add 'KB', 'MB' or 'GB' after the number. Here are some correct values: 500KB, 15MB, 2GB.

Jonathan Williams
  • 14.5k
  • 1
  • 26
  • 59