Proposed changes to provide compression support for rotated log files
In response to http://bugs.python.org/issue13516 I'm thinking of implementing some changes in the rotating file handlers, as outlined here: http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.ht... The changes (including tests) are almost ready to check in, but I thought I'd give any one here who's interested a chance to comment, in case they can spot any shortcomings of the approach I suggest. Regards, Vinay Sajip
On Thu, 15 Dec 2011 10:31:08 +0000 (UTC)
Vinay Sajip
In response to http://bugs.python.org/issue13516 I'm thinking of implementing some changes in the rotating file handlers, as outlined here:
http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.ht...
The changes (including tests) are almost ready to check in, but I thought I'd give any one here who's interested a chance to comment, in case they can spot any shortcomings of the approach I suggest.
"def filename(self, name)" sounds like a poor method name. Regards Antoine.
On 12/15/2011 5:31 AM, Vinay Sajip wrote:
In response to http://bugs.python.org/issue13516 I'm thinking of implementing some changes in the rotating file handlers, as outlined here:
http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.ht...
The changes (including tests) are almost ready to check in, but I thought I'd give any one here who's interested a chance to comment, in case they can spot any shortcomings of the approach I suggest.
It appears you are adding two methods to do the same thing. One is to subclass and override one or two functions. The other is to define one or two custom functions and attach as attributes. Both seem equally easy. (Actually, subclassing takes one line less.) Are both really needed? -- Terry Jan Reedy
Terry Reedy
It appears you are adding two methods to do the same thing. One is to subclass and override one or two functions. The other is to define one or two custom functions and attach as attributes. Both seem equally easy. (Actually, subclassing takes one line less.) Are both really needed?
That's why I asked for comments. Subclassing can be avoided if the callable attributes are used, which is a win, for example, if you have both timed and non-timed rotating handlers: you can use the same callables in each case, whereas with subclassing you would have to subclass both the timed and non-timed handler classes. Also, in scenarios where one might want to use alternative compression formats based on an application's configuration, there would be less work because one wouldn't need to create multiple subclasses. So for most cases the strategy would be to use the callable attributes, and if they were inappropriate for some reason, they could subclass and override the methods. I've factored out the two methods from the existing implementation because at the moment, it's hard to subclass without copying the whole doRollover method (as in the ActiveState example). Regards, Vinay Sajip
participants (3)
-
Antoine Pitrou
-
Terry Reedy
-
Vinay Sajip