[ https://issues.apache.org/jira/browse/LOG4J2-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14935730#comment-14935730 ]
Carlos Silva A. commented on LOG4J2-435: ---------------------------------------- Hi, I just run into this issue, and would like to offer an additional solution maybe intermediate or in addition to the current direction of the discussion: I would be happy with removing only one file: the one that is goinng out of scope when the time policy is triggered. e.g. reusing the DefaultRolloverStrategy max attribute 1. Determine the precision of the filename pattern e.g. for "log-HH:mm:dd-HH" it would be Calendar.HOUR_OF_DAY In cases where the pattern contains %i, then this mechanism will be disabled and the legacy behavior will take place. 2. When a rolling is triggered, calculate the time of the obsolete file by substracting DefaultRolloverStrategy.max precision units from the current time 3. Remove file(if exists) evaluating the time found in #2 with the filePattern I could provide the implementation if you think this is worth to be included. > Support limiting number of log files based on date pattern > ---------------------------------------------------------- > > Key: LOG4J2-435 > URL: https://issues.apache.org/jira/browse/LOG4J2-435 > Project: Log4j 2 > Issue Type: Improvement > Reporter: Arkin Yetis > Assignee: Ralph Goers > Labels: Rollover > Attachments: LimitingRolloverStrategy.java, SizeParser.java > > > DefaultRolloverStrategy max attribute only applies if you have a %i in the > file pattern. This request is to enhance DefaultRolloverStrategy or another > appropriate component to allow a max number of files limit to apply across > days/months/years when a filePattern includes a date pattern. -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org