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

Spamme commented on LOG4NET-27:
-------------------------------

You can try to guess the old file names but you can't never be sure, perhaps 
the user has changed the string format, in this case how do you find them? You 
can try to solve this problem in many ways but at the end there isn't a sure 
way to do it. For example:
- You could use the file name without the date format to find all the log files 
and use the file date time to determine which log file is older
--> The user could have two loggers in the same folder one with the file name 
"logger.log" and the other with the name "2nd logger.log", so looking for 
"logger.log" in the file name would find both logger files.
--> The user could have opened the file in a editor and just saved it and the 
log file has now the actual date and time, so the date time of the file can't 
be used
- You could add an header inside each log file to recognize them, for example: 
"LoggerName" + UTC Date, and scan all the files for the header.
--> The user could have renamed a log file to prevent to be deleted, but in 
this case would be deleted too
--> You have to open all the files to read the header, which is not really an 
efficient solution

So use the KISS and go for the standard case, which will cover 99% of the cases:
- The user configure the logger for deleting the old log files.
--> From this point the logger remembers the generate file and delete them when 
their time has come



                
> Rolling files on date/time boundaries doesn't support a maximum number of 
> backup files.
> ---------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-27
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-27
>             Project: Log4net
>          Issue Type: New Feature
>          Components: Appenders
>    Affects Versions: 1.2.11
>            Reporter: Florian Ramillien
>            Priority: Minor
>             Fix For: 1.2 Maintenance Release
>
>         Attachments: LOG4NET-27.patch, RollingFileAppender.cs, 
> RollingFileAppender.cs, RollingFileAppender.cs, RollingFileAppender.cs.patch, 
> RollingFileAppender.patch
>
>
> A maximum of backup files exist when rolling files on file size, but not for 
> rolling on date/time.
> This can be implemented with the same config key : MaxSizeRollBackups

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to