How to configure a log4j file appender which rolls the log file every 15 minutes

前端 未结 5 2094
孤独总比滥情好
孤独总比滥情好 2020-12-06 13:01

I understand that i can use a DailyRollingFileAppender to roll the log file every month, day, half-day, hour or minute. But how can i configure log4j to roll the log file ev

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 13:08

    I know its late to reply , but below solution will help you out and other user who search the same question and stuck back to this thread.

    I modified DailyRollingFileAppender.java to include time interval clause in file rolling , this will allow user to set minutes interval at which rolling has to be done

    include file from here http://abheygupta.com/DailyRollingFileAppender.java

    and configure this way ,tim interval can have any values from 60 factors [1,2,3,4,5,6,10,12,15,20,30,60] log4j.appender.mtlog_api11.DatePattern='.'mmHHMMddyyyy log4j.appender.mtlog_api11.TimeInterval=10

    it will work normal in other DatePattern than specified above .

提交回复
热议问题