[logback-dev] [JIRA] (LOGBACK-1489) with SizeAndTimeBasedRollingPolicy totalSizeCap cannot be smaller than maxFileSize
QOS.CH (JIRA)
noreply-jira at qos.ch
Wed Oct 23 12:05:00 CEST 2019
Davide Imbriaco created LOGBACK-1489:
----------------------------------------
Summary: with SizeAndTimeBasedRollingPolicy totalSizeCap cannot be smaller than maxFileSize
Key: LOGBACK-1489
URL: https://jira.qos.ch/browse/LOGBACK-1489
Project: logback
Issue Type: Bug
Components: logback-core
Affects Versions: 1.2.3
Environment: any (tested on ubuntu linux, java 8)
Reporter: Davide Imbriaco
Assignee: Logback dev list
Priority: Minor
trying to setup SizeAndTimeBasedRollingPolicy with totalSizeCap smaller than maxFileSize, i get this error:
{code:java}
11:43:00,082 |-ERROR in c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy at 43834411 - totalSizeCap of [2 MB] is smaller than maxFileSize [5 MB] which is non-sensical{code}
it is true that for plaintext files a smaller totalSizeCap would be non-sensical, but it may make perfect sense if log files are zipped/gzipped.
Logs compress very well. If applying gzip, a 100MB log file is compressed to a file that is usually 10MB to 1MB (or less). In this case it is reasonable to have, as an example, maxFileSize set to 100M and totalSizeCap set to 50MB.
Config example:
{code:java}
<appender name="MYAPPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/${LOG_NAME}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_ARCHIVE_DIR}/${LOG_NAME}.log.%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<maxFileSize>100MB</maxFileSize>
<maxHistory>10</maxHistory>
<totalSizeCap>50MB</totalSizeCap>
</rollingPolicy>
<encoder>
<pattern>${LOG_PATTERN}</pattern>
</encoder>
</appender>{code}
--
This message was sent by Atlassian JIRA
(v7.3.1#73012)
More information about the logback-dev
mailing list