How to rotate log files based on time rather than size in Log4j?

后端 未结 5 1086
别跟我提以往
别跟我提以往 2020-12-14 02:56

I use Log4j with the RollingFileAppender to create a log rotation based on size.

How can I configure it to log to each file for a certain amount of

5条回答
  •  轮回少年
    2020-12-14 03:06

    Use a DailyRollingFileAppender.

    In particular, setting its 'datePattern' property to '.'yyyy-MM-dd-HH would cause file to rotate every hour.

提交回复
热议问题