Details
-
Bug
-
Resolution: Not a bug
-
Minor
-
1.1.11
-
spring-boot: 1.5.4
jdk: "1.8.0_181"
Red Hat 4.8.5-28
Description
TimeBasedRollingPolicy with MaxHistory would not delete log file created by startup with 0 size.
logback.xml
<appender name="TRANSACTION_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>${LOG_DIR}/transaction_%d{yyyy-MM-dd-HH}.log</FileNamePattern> <MaxHistory>5</MaxHistory> </rollingPolicy> <encoder> <pattern>%msg%n</pattern> </encoder> </appender>
before rolling:
-rw-r--r-- 1 root root 0 Feb 28 08:23 transaction_2019-02-28-08.log -rw-r--r-- 1 root root 0 Feb 28 10:02 transaction_2019-02-28-10.log -rw-r--r-- 1 root root 13466 Feb 28 17:43 transaction_2019-02-28-17.log -rw-r--r-- 1 root root 530 Feb 28 19:04 transaction_2019-02-28-19.log -rw-r--r-- 1 root root 530 Feb 28 20:25 transaction_2019-02-28-20.log
after:
-rw-r--r-- 1 root root 0 Feb 28 08:23 transaction_2019-02-28-08.log -rw-r--r-- 1 root root 0 Feb 28 10:02 transaction_2019-02-28-10.log -rw-r--r-- 1 root root 4563 Mar 1 03:35 transaction_2019-03-01-03.log
restart at 7:56 then rolling
-rw-r--r--. 1 root root 0 Feb 28 08:23 transaction_2019-02-28-08.log -rw-r--r--. 1 root root 0 Feb 28 10:02 transaction_2019-02-28-10.log -rw-r--r--. 1 root root 4563 Mar 1 03:35 transaction_2019-03-01-03.log -rw-r--r--. 1 root root 2529 Mar 1 04:02 transaction_2019-03-01-04.log -rw-r--r--. 1 root root 2528 Mar 1 05:28 transaction_2019-03-01-05.log -rw-r--r--. 1 root root 2528 Mar 1 06:09 transaction_2019-03-01-06.log -rw-r--r--. 1 root root 2527 Mar 1 07:07 transaction_2019-03-01-07.log -rw-r--r--. 1 root root 2538 Mar 1 08:03 transaction_2019-03-01-08.log
issue:
transaction_2019-02-28-08.log and transaction_2019-02-28-10.log havent been deleted
they were created in startup with no content
Attachments
Issue Links
- relates to (in)
-
LOGBACK-1562 The old log files didn't get removed when fileNamePattern is configured by "yyyyMMddHH"
- Resolved