You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2019/06/02 20:20:12 UTC

[GitHub] [logging-log4net] fnasimbd opened a new pull request #50: Fixes LOG4NET-620 RollingFileAppender extension that backs up only a last specified period (days, hours, etc.) proposal

fnasimbd opened a new pull request #50: Fixes LOG4NET-620 RollingFileAppender extension that backs up only a last specified period (days, hours, etc.) proposal
URL: https://github.com/apache/logging-log4net/pull/50
 
 
   This pull request attempts implementing the feature requested in [LOG4NET-620](https://issues.apache.org/jira/browse/LOG4NET-620).
   
   A new `RollingFileAppender` derivative `RollingFileAppenderTrailing` implements the feature. Still incomplete though, here follows roughly how it works, with requests for suggestions and opinions at places.
   
   1. The new `RollingFileAppenderTrailing` preserves only logs trailing the current timestamp by a user specified `TrailPeriod` (new public property, set by user in configuration, name suggestions are welcome :) .) I know log4net community prefers _composition over subclasses_; still, however, I am putting the current subclass for consideration.
   2. `TrailPeriod`. The tailing period of logs to be preserved, specified as a string representation of a standard .NET `TimeSpan`. Any better idea for format is welcome.
   3. On startup (`ActivateOptions`) and on the first log event every _trail period_ since startup, all outdated log files, based on the file's last write time, are cleaned up. I made this choice ostensibly as an optimization measure: checking for cleanup on each log event degrades performance. This choice certainly has an implication: outdated log files may accumulate in cases where multiple files are created in a trail period (e.g. hourly `DatePattern` for a `TrailPeriod` greater than a day.) Expecting opinions on this.
   4. Log files are deleted only if they are _absolutely_ outside the trail period; files with entries _straddling_ the `TrailPeriod` are preserved.
   5. The test class `RollingFileAppenderTrailingTest` extends `RollingFileAppenderTest`. In order to make all the base tests available to the derivative, I have made the logger factory methods (`CreateLogger`) virtual-instance methods instead of private-static ones.
   6. I am coming up with more tests. Some tests may run for over a minute; is there any restriction on individual test execution time?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services