[issue13516] Gzip old log files in rotating handlers

Mark Grandi report at bugs.python.org
Thu Aug 18 13:33:42 EDT 2016


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 common feature in pretty much everything that it would be nice to have it built in rather than having a custom RotatingHandler subclass that just compresses the logs and does nothing else in every project I work with.

While not python, i searched github for logback/slf4j (java logging framework) entries for their equivilent of TimedRotatingFileHandler and I found quite a few results:

https://github.com/search?utf8=%E2%9C%93&q=fileNamePattern%2F%3E*.gz+language%3AXML&type=Code&ref=searchresults

you don't even have to change the API of it, it could act the same way as the tarfile module, where if the 'filename' argument ends in one of "bz2", "gz" or 'xz" then it is compressed with that compression type, and if not, then it doesn't compress it (what it does now)

and, that is how logback/slf4j does it as well (http://logback.qos.ch/manual/appenders.html#fwrpFileNamePattern)

----------
nosy: +markgrandi

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13516>
_______________________________________


More information about the Python-bugs-list mailing list