gpt4 book ai didi

Logback 日志文件轮换策略

转载 作者:行者123 更新时间:2023-12-05 05:21:44 25 4
gpt4 key购买 nike

我在 logback.xml 中使用以下内容。这仅保留 21 个文件并删除较旧的日志文件。谁能建议如何停止文件删除?

<appender name="MY_UPDATES_APPENDER"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender -->
<File>logs/upilogs/upi-app.log
</File>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>logs/upilogs/my-app.%i.log
</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>50</maxIndex>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>200MB</maxFileSize>
</triggeringPolicy>
<encoder>
<Pattern>%d %X %-5level %logger{36} - %msg%n%ex</Pattern>
</encoder>
</appender>

最佳答案

这是一个 feature的回退。从链接的 URL 引用

Given that the fixed window rolling policy requires as many file renaming operations as the window size, large window sizes are strongly discouraged. When large values are specified by the user, the current implementation will automatically reduce the window size to 20.

关于Logback 日志文件轮换策略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42409597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com