~reynolds.chin/glance/adaptive_index_listing

Viewing all changes in revision 206.

  • Committer: Mark McLoughlin
  • Date: 2011-08-25 12:51:29 UTC
  • Revision ID: git-v1:ecbcc09ce5c337a84d8adf19f957529c4f76a075
Switch file based logging to WatchedFileHandler for logrotate

Fixes lp:772397

FileHandler opens the logfile at startup, keeps the stream open and
continues to log to it forever.

If logrotate decides to rotate the file, it will rename the original
file and a new file is created with the same attributes as the original
file.

The problem is that the process is still writing to the original file,
not the newly created file. Traditionally, system daemons respond to
a SIGHUP by re-opening log files and logrotate can be configured to
deliver this signal on rotation.

However, python has an elegant solution. WatchedFileHandler monitors
the inode for the specified log file name and, if that ever changes,
it re-opens the stream.

Nova already uses WatchedFileHandler to good effect. See:

  https://code.launchpad.net/~soren/nova/logrotate/+merge/50292

Change-Id: I7f693f133d230d65d7c94ebf3a2ec0c8b362f993

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: