log4j2每周归档一次,每次启动时轮换?[英] log4j2 archive every week, rotate every startup?

本文是小编为大家收集整理的关于log4j2每周归档一次,每次启动时轮换?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我试图弄清楚如何简单地在每个启动上重命名活动日志文件,并每周归档所有旋转的文件.

我被迫在RollingFile Appender声明中指定" FilePattern",而不是在策略上.这很有意义吗?

推荐答案

我最终进行了自己的删除实现,并将其附加到DefaultrolloverStrategy上,以便在删除之前将所有内容拉开.您可以在:

上找到Sourcecode 在

本文地址:https://www.itbaoku.cn/post/1575074.html

问题描述

I am trying to figure out how to simply rename the active log file on every startup, and archive all the rotated files once a week.

I am forced to specify the "filePattern" at the RollingFile appender declaration, instead of at the policy. Do this make sense?

推荐答案

I ended up doing my own implementation of a DeleteAction, and attaching it to a DefaultRolloverStrategy, so that it is zipping everything before deleting. You can find the sourcecode at:

https://github.com/lqbweb/log4j2-ZipDelete