logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carlos Silva A. (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-435) Support limiting number of log files based on date pattern
Date Tue, 29 Sep 2015 19:47:04 GMT

    [ 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:46 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 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.



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 

   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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message