[
https://issues.apache.org/jira/browse/LOG4NET-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13559600#comment-13559600
]
Hans Meier commented on LOG4NET-27:
-----------------------------------
In parallel to the last activities here I started my own implementation of the
"max number of date roll backups" feature on 14. January based on trunk rev
1431235. After this day I didn't check for activities here because it has been
so quiet for so long so I missed that something was going on in parallel.
So here it is. As far as I can see it does exactly what is intended.
* limit the number of periods logs are kept
* roll of old files upon application start works as expected
* composite mode works, size limits apply for each period separately
* count directions forward and backward work as expected
* preserve log file extension works as expected
* using static log file works as expected
* adding a footer after end of the respective period doesn't affect date
indexing (option layout->footer). last write time is only used for static log
files any more because using last write time confused the roll mechanism when a
footer is configured. with footer the last write time always is out-of-period
for the last logfile of the period.
I tested it with several combinations of settings. I also added some tests.
Unfortunately there were not so many tests regarding roll over date so I just
added some tests for some details I was particularly interested in.
To ease reviewing and committing the zip attached contains 4 steps:
step1:
only trivial changes:
* tabs and spaces, formatting etc.
step2:
a bugfix.
* in RollOverIfDateBoundaryCrossing preserveLogFileExtension wasn't respected.
step3:
modifications without affecting existing code.
* some trivial changes in visibility, regions etc.
* additional functions, properties, members that aren't yet used from existing
code.
* NextCheckDate -> GetRollDateTimeRelative:
Function works identically if called with relativePeriod==1. Existing code
does this.
Additionally any count of positive or negative period jumps can be calculated.
* Fully isolated getting last write time in a function GetLastWriteTime
* Split CombinePath into a static version and a member function to call it.
Needed
to allow implementing and testing one of the new functions as static
function.
That new, static function uses CombinePath so i needed a static version.
step4:
use the new functionality
I hope that helps ...
> 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: appender_diff, LOG4NET-27.patch, RollingFileAppender.cs,
> RollingFileAppender.cs, RollingFileAppender.cs, RollingFileAppender.cs.patch,
> rollingfileappender.diff, RollingFileAppender.patch, RollingFileAppender.zip
>
>
> 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