Skip to content

Instantly share code, notes, and snippets.

@gkazior
Last active August 29, 2015 14:16
Show Gist options
  • Save gkazior/5ef865f5fd34f4996430 to your computer and use it in GitHub Desktop.
Save gkazior/5ef865f5fd34f4996430 to your computer and use it in GitHub Desktop.
Log appender rolled by day
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append>
<encoder>
<pattern>%date %message %n%rEx{full}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--log files are created in logs with name different for each day-->
<fileNamePattern>${application.home}/logs/app-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--log files are created in separate folder for each day-->
<!--<fileNamePattern>${application.home}/logs/%d{yyyy/MM/dd}/tumrestapi-%d{yyyy-MM-dd}.%i.log</fileNamePattern>-->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- Keep no more than 30 days' data. -->
<maxHistory>30</maxHistory>
<cleanHistoryOnStart>false</cleanHistoryOnStart>
</rollingPolicy>
</appender>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment