[New-bugs-announce] [issue13516] Gzip old log files in rotating handlers

Raul Morales report at bugs.python.org
Thu Dec 1 19:00:23 CET 2011


New submission from Raul Morales <raul.mh at 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 and TimedRotatingFileHandler to select the number of old files you want to compress.

For example, if you set the argument to 0 (default) no files are gzipped , but if you set it to 3 you get the following log files:
app.log
app.log.1
app.log.2
app.log.3.gz
app.log.4.gz
...
app.log.n.gz

For TimedRotatingFileHandler it works similar, gzipping from the n-th newer log file to the oldest log file:
app.log
app.log.2011-12-01
app.log.2011-11-30
app.log.2011-11-29.gz
app.log.2011-11-28.gz
...

A possible patch is attached

----------
components: Library (Lib)
files: log.patch
keywords: patch
messages: 148732
nosy: ramhux, vinay.sajip
priority: normal
severity: normal
status: open
title: Gzip old log files in rotating handlers
type: feature request
versions: Python 3.3
Added file: http://bugs.python.org/file23830/log.patch

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


More information about the New-bugs-announce mailing list