Log4j DailyRollingFileAppender [英] Log4j DailyRollingFileAppender

查看:97
本文介绍了Log4j DailyRollingFileAppender的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个当前配置为每小时滚动的日志文件.首次创建时,该文件名为logfile.log,并将其翻转后重命名为logfile.log.YYYY-MM-DD-HH.

I have a log file currently configured to roll over every hour. When it is first created it is called logfile.log, and once it rolls over it is renamed to logfile.log.YYYY-MM-DD-HH.

我想要立即使用logfile.log.YYYY-MM-DD-HH命名约定而不是logfile.log创建日志文件.

What I would like is for the log file to be created immediately using the logfile.log.YYYY-MM-DD-HH naming convention as opposed to logfile.log.

有什么想法吗?

推荐答案

看看这篇文章:

它讨论了此处所述的DatedFileAppender的使用:

It discusses the use of DatedFileAppender described here:

我从没用过,但是它似乎完全可以满足您的需求.

I never used this one, but it seems to be doing exactly what you need.

这篇关于Log4j DailyRollingFileAppender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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