开发者

Log4j DailyRollingFileAppender

开发者 https://www.devze.com 2023-01-25 05:31 出处:网络
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-H开发者_如何学编程H.

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-H开发者_如何学编程H.

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:

  • http://tecbites.blogspot.com/2006/10/log4j-tipps-and-tricks.html

It discusses the use of DatedFileAppender described here:

  • http://minaret.biz/tips/datedFileAppender.html

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号