Use the WatchedFileHandler for logging to allow log rotation.
Review Request #1587 — Created May 9, 2010 and submitted — Latest diff uploaded
Use the WatchedFileHandler for logging to allow log rotation. We've been using FileHandler, which writes to a file but stops logging when the file is pulled out from underneath it (such as during log rotation). Python 2.6 includes a new WatchedFileHandler, which checks before writing whether the log file still exists. If it doesn't, it reopens the file for writing. This allows it to handle log rotation fine. We now make use of this logger for both the standard log and the profile log. We also bundle the WatchedFileHandler as part of Djblets (with a copyright notice) in order to support Python 2.4 and 2.5.