Logback,每天设置最大历史文件 [英] Logback, set max history files per day

查看:776
本文介绍了Logback,每天设置最大历史文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 TimeBasedRollingPolicy SizeAndTimeBasedFNATP 触发我的回归配置策略。日志文件的翻转设置为每天发生,如果日志文件大小超出限制,也会触发日志文件。

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.

如果我在 TimeBasedRollingPolicy 上执行setMaxHistory(10)并每日翻转,那么它将归档所有日志文件在过去10天。但我想要的是每天在SizeAndTimeBasedFNATP上设置maxHIstory。

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.

这是否可以使用logback?

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.

这篇关于Logback,每天设置最大历史文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆