最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

logging - Logback Fails to Delete `.tmp` Files After Log Rotation - Stack Overflow

programmeradmin1浏览0评论

Logback is creating .tmp files during log rotation, and they are not being deleted even after the retention period.

These .tmp files can be generated for various reasons, but the goal is to ensure they are automatically removed after log rotation or at a later stage.

Using logback 1.2.10 version.

Below is the .tmp file and logback configuration.

-rw-rw----+ 1 root root 121 Mar 1 00:00 /var/log/cli/cli_2025-02-28.0.log372862483201017.tmp

     `<appender name="CliAppender"
            class="ch.qos.logback.core.rolling.RollingFileAppender">
            <file>/var/log/cli/cli.log</file>
            <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
             <fileNamePattern>/var/log/cli/cli_%d{yyyy-MM-dd}.%i.log.gz
                    </fileNamePattern>
                            <maxFileSize>50MB</maxFileSize>
                    <!-- keep 30 days' worth of history -->
                    <maxHistory>30</maxHistory>
            </rollingPolicy>

            <encoder>
                    <charset>UTF-8</charset>
                    <pattern>%d{"yyyy-MM-dd'T'HH:mm:ss,SSSXXX"} [%thread] %-5level %msg%n
                    </pattern>
            </encoder>
    </appender> `       
发布评论

评论列表(0)

  1. 暂无评论