Logback,设置每天最大历史文件数
我使用 TimeBasedRollingPolicy
和 SizeAndTimeBasedFNATP
触发策略进行 logback 配置。日志文件的滚动设置为每天发生,并且如果日志文件大小超出限制也会触发。
如果我在 TimeBasedRollingPolicy
上执行 setMaxHistory(10) 并每日滚动,那么它将归档过去 10 天内的所有日志文件。但我想要的是每天在 SizeAndTimeBasedFNATP 上设置 maxHIstory 。
这可以通过 logback 实现吗?
I use TimeBasedRollingPolicy
and SizeAndTimeBasedFNATP
triggering policy for my logback configuration. The rollover of log files is set to happen every day and it will also be triggered if log file size goes beyond a limit.
If I do setMaxHistory(10) on TimeBasedRollingPolicy
with a daily roll over, then it will archive all log files in last 10 days. But what I want is to set maxHIstory on SizeAndTimeBasedFNATP each day.
Is this possible with logback?
当 SizeAndTimeBasedFNATP 和 MaxHistory 设置为 10 时,超过 10 天的日志将被删除(假设每日滚动计划)。大小不计入删除逻辑中。
With SizeAndTimeBasedFNATP and MaxHistory set to 10, the logs older than 10 days will be removed (assuming daily rollover schedule). Size is not factored in the into removal logic.