Log4j DailyRollingFileAppender[英] Log4j DailyRollingFileAppender

本文是小编为大家收集整理的关于Log4j DailyRollingFileAppender的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我当前配置了一个日志文件,每小时都要滚动.首次创建时,它称为logfile.log,一旦将其滚动为logfile.log.yyyy-mm-dd-hh.

我想要的是要使用logfile.log.yyyy-mm-dd-hh命名约定立即创建日志文件,而不是logfile.log.

有什么想法?

推荐答案

看这篇文章:

它讨论了此处描述的使用日期的使用:

我从来没有使用过这个,但它似乎是在做您需要的.

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

问题描述

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.

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.

Any ideas?

推荐答案

Take a look at this post:

It discusses the use of DatedFileAppender described here:

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