问题描述
因此log4j带有两个现有的日志滚轮:RollingFileAppender和DailyRollingFileAppender.有没有人听说过同时执行前者功能的appender?
So log4j comes with two existing log rollers: RollingFileAppender, and DailyRollingFileAppender. Has anyone heard of an appender that does both of what the former do?
我需要一个附加程序,该附加程序将根据文件大小滚动日志文件,但还要向其附加当前日期.
I need an appender that will roll log files based on filesize, but also append the current date to it.
我一直在考虑创建自己的附加程序,但是如果已经创建了一个附加程序,为什么不节省时间并使用那个附加程序呢?
I've been thinking about creating my own appender, but if there is already one that has been created, why not save the time and use that one?
推荐答案
好像您想要混合 http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/DailyRollingFileAppender.html 和 http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html .
您必须自己编写代码.好消息是:您只需合并"这些类的功能,而无需低级"新代码.
You'll have to code by yourself. The good news is: you'll just have "merge" those classes functionality, no "low level" new code required.
这篇关于如何使log4j根据日期和大小滚动文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!