[Twisted-Python] Re: log rotation
Tsai Li Ming
mailinglist at ltsai.com
Thu Sep 23 20:40:35 EDT 2004
James Y Knight wrote:
> On Sep 21, 2004, at 9:21 AM, <exarkun at divmod.com> wrote:
>> logrotate should rotate twistd logfiles just fine. It shuts down a
>> process, moves its log files around, then restarts it.
> That's not how it normally works.
> Generally one of two strategies is employed:
> - Move the current log files, then send a signal to the process to tell
> it to reload its configuration file, which causes it to reopen the
> - Copy the log files, and truncate the old file.
> The first option is much nicer, so ideally for integration with
> logrotate, you would want to install some signal-handler that tells
> twistd to reopen all its logfiles.
That's what I would thought too.
1. logrotate will rotate the file. (server -> server.1)
2. a signal (usually a HUP) is sent to the process and the process will
close the log file's FD. (server.1)
3. Process will reload it's current configuration and write to a new log
However, Twisted has its own mechanism of handling log rotation.
More information about the Twisted-Python