Two questions about logging

Roy Smith roy at panix.com
Wed Jan 11 21:34:23 EST 2012


In article 
<7dabf43f-3814-47b6-966a-1439f56548b5 at i6g2000vbk.googlegroups.com>,
 Matthew Pounsett <matt.pounsett at gmail.com> wrote:

> First, I'd like to be able to permit users to do more typical log
> rotation, based on their OS's log rotation handler, rather than
> rotating logs from inside an application.  This is usually handled by
> signalling an application with a HUP, whereupon it closes and then re-
> opens all of its logs, getting new file handles (and new inodes).  I
> don't see anything in the Handler methods (or anywhere else) that
> would let me tell a logger object to refresh the file handles on a log
> file.  Is there some standard way to deal with this?

What I would do is log to syslog (logging.handlers.SysLogHandler) and 
let syslog worry about rotating log files.  Why reinvent the wheel?



More information about the Python-list mailing list