${LOG_" /> ${LOG_" /> ${LOG_"/>

In Spring Boot application MaxHistory in logging is not deleting log files older than 2 days

44 Views Asked by At

Following is my logback-spring.xml code:

<appender name="JiraIFHistoricAppender"
        class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${LOG_HISTORIC_PATH}/Jira/Jira-Publisher-Historic-Webapp.log
        </file>
        <encoder>
            <pattern>${LOG_PATTERN}</pattern>
        </encoder>
        <rollingPolicy
            class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${LOG_HISTORIC_PATH}/Jira/Archived-Logs/Jira-Publisher-Historic-Webapp-%d{yyyy-MM-dd}.%i.log
            </fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>2</maxHistory>
            <cleanHistoryOnStart>true</cleanHistoryOnStart>
        </rollingPolicy>
    </appender>

Here I have added maxHistory parameter to delete old archived files older than 2 days but it is not working. Can anyone please help me with the solution?

Thanks & Regards, Preethi H R

0

There are 0 best solutions below