[logback-dev] [JIRA] (LOGBACK-1458) TimeBasedRollingPolicy with MaxHistory would not delete log file created by startup with 0 size

QOS.CH (JIRA) noreply-jira at qos.ch
Fri Mar 1 06:24:00 CET 2019


Tianyu Li created LOGBACK-1458:
----------------------------------

             Summary: TimeBasedRollingPolicy with MaxHistory would not delete log file created by startup with 0 size
                 Key: LOGBACK-1458
                 URL: https://jira.qos.ch/browse/LOGBACK-1458
             Project: logback
          Issue Type: Bug
          Components: logback-core
    Affects Versions: 1.1.11
         Environment: spring-boot: 1.5.4

jdk: "1.8.0_181"

Red Hat 4.8.5-28
            Reporter: Tianyu Li
            Assignee: Logback dev list
            Priority: Minor


TimeBasedRollingPolicy with MaxHistory would not delete log file created by startup with 0 size.

 

logback.xml
{code:java}
    <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>
{code}
 before rolling:
{code:java}
-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
{code}
after:
{code:java}
-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
{code}
 

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



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list