log4j2 archive every week, rotate every startup?

2019-07-24 23:56发布

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?

1条回答
戒情不戒烟
2楼-- · 2019-07-25 00:24

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

查看更多
登录 后发表回答