Skip to content

Instantly share code, notes, and snippets.

@BenWhitehead
Last active August 29, 2015 14:09
Show Gist options
  • Save BenWhitehead/6018b052e44c2c68d2ec to your computer and use it in GitHub Desktop.
Save BenWhitehead/6018b052e44c2c68d2ec to your computer and use it in GitHub Desktop.
Logback configuration for rolling file appender
<configuration scan="true" scanPeriod="30 seconds">
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>app.log.%i.zip</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>10</maxIndex>
</rollingPolicy>
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>10MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level [%thread] %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="FILE"/>
</root>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment