[Twisted-Python] Log Rotation Blocks w/ Large Number of Log Files

Jason J. W. Williams jasonjwwilliams at gmail.com
Tue Mar 16 17:34:33 EDT 2010


Twistd blocks for a long period of time when the number of log files
built up is large, thereby causing connections to freeze and
(depending on the length of the rotation) time out.

Given I've only used Twisted in the past and not contributed to it, I
was curious if someone could take a look at my changes to
twisted.python.logfile.LogFile's rotate() method and see if there's
any reason the changes would be a bad idea.

What I've attempted to do is defer the rotation of the old log files
to a thread, and only rotate the current log file in the foreground.

Original twisted.python.logfile.LogFile.rotate(): http://gist.github.com/334538

My version with deferral of old log rotation: http://gist.github.com/334545

(Changes are against Twisted 10.0).

Thank you in advance.


More information about the Twisted-Python mailing list