[ 
https://issues.apache.org/jira/browse/LOG4J2-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14935730#comment-14935730
 ] 

Carlos Silva A. edited comment on LOG4J2-435 at 9/29/15 7:51 PM:
-----------------------------------------------------------------

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 file going out of scope when 
the time policy is triggered.

e.g. reusing the DefaultRolloverStrategy max attribute 

# 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.
# When a rolling is triggered, calculate the time of the obsolete file by 
substracting DefaultRolloverStrategy.max precision units from the current time
# 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.



was (Author: csilva):
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 

# 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.
# When a rolling is triggered, calculate the time of the obsolete file by 
substracting DefaultRolloverStrategy.max precision units from the current time
# 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

Reply via email to