Created
July 20, 2023 09:21
-
-
Save saswata-dutta/bfd8a116036388fb029e3229e69d680b to your computer and use it in GitHub Desktop.
logback size and time based rolling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<file>./logs/myapp.log</file> | |
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |
<!-- daily rollover --> | |
<fileNamePattern>./logs/myapp-%d{yyyy-MM-dd_HH}.%i.log.gz</fileNamePattern> | |
<!-- keep 10 days' worth of history capped at 3GB total size --> | |
<maxHistory>240</maxHistory> | |
<maxFileSize>100MB</maxFileSize> | |
<totalSizeCap>3GB</totalSizeCap> | |
</rollingPolicy> | |
<encoder> | |
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern> | |
</encoder> | |
</appender> | |
<root level="INFO"> | |
<appender-ref ref="ROLLING" /> | |
</root> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment