如何使log4j根据日期和大小滚动文件? [英] How do you get log4j to roll files based on date and size?

查看:622
本文介绍了如何使log4j根据日期和大小滚动文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此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?

推荐答案

好像您想要混合您必须自己编写代码.好消息是:您只需合并"这些类的功能,而无需低级"新代码.

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根据日期和大小滚动文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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