Mark Grandi added the comment:
While I will say that is slightly easier than subclassing, it still requires a
function, or a variation of that to be present in every project that wants to
have a RotatingHandler + compression, and extra lines if you use
logging.config.dictConfig, as you will
Vinay Sajip added the comment:
You don't need a subclass - you can specify your own function to do it, as in
the cookbook example:
https://docs.python.org/3/howto/logging-cookbook.html#using-a-rotator-and-namer-to-customize-log-rotation-processing
--
Mark Grandi added the comment:
I just ran into this myself, and would challenge the notion that just because
few people complain about the fact that built in compression isn't built in for
logging handlers (such as TimedRotatingFileHandler), that it isn't a needed
feature. This is such a
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
Refactoring in 57295c4d81ac supports this use case.
--
resolution: - fixed
stage: - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
Raul Morales raul...@gmail.com added the comment:
I have just posted a comment, too.
http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.html?showComment=1323891345946#c2875224484376643310
With this approach, anyone can implement support for any format easily. It is
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
It seems that you agree that the basic mechanism is good enough to build on, so
I'd rather leave the proposed stdlib change as is, but provide examples of how
to achieve gzip/zip compression for rotated logs in the Logging Cookbook. The
Raul Morales raul...@gmail.com added the comment:
Ok, it is reasonable. It has no sense add support for compression since I am
the only user who want it.
Maybe in the future ;)
--
___
Python tracker rep...@bugs.python.org
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
See this for the proposed resolution:
http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.html
--
___
Python tracker rep...@bugs.python.org
Raul Morales raul...@gmail.com added the comment:
I use a similar code in my scripts, but I thought it could be useful to have
this feature built into python.
If you prefer subclassing for compression, what about a compressing subclass
built into logging package?
If you think it is a good
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
I have worked out a possible approach. I will post about it soon, and add a
link to it from this issue.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13516
Raul Morales raul...@gmail.com added the comment:
Interesting, then I will wait your post. Thanks.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13516
___
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment:
Some people might want other compression methods, e.g. bz2, zip, lzma ...
Have you considered subclassing the existing handler classes as in the
following example?
New submission from Raul Morales raul...@gmail.com:
Sometimes log files grow very quickly and consume too much disk space (e.g.
DEBUG), so compress old log files saves disk space without losing the
information from log files.
I propose to add a gzip or compress argument to RotatingFileHandler
13 matches
Mail list logo