Log4j DailyRollingFileAppender

时光毁灭记忆、已成空白 提交于 2019-12-08 05:46:01

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/4200794/log4j-dailyrollingfileappender

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!