Supervisor/supervisor — pull request #78 by whitmo (2011-12-16 15:41:19+00:00)
Title: Fix log rotation for shared files

Fix for issue #10.

First commit is a failing test, second is an implemenation and an additional test.

Fixes issue where when multiple processes refer to the same log file and the file reaches the byte limit, the log rolls over in an unpredictable fashion as all logging handlers refer to the original file (and therefore attempt to roll it with their next attempt to log).

This implementation uses a descriptor to interact with a class variable, a global dictionary using the original filepath as a key whose values are the currently open streams (aka the current actual file logged). On rollover, the current stream for a particular "file" is updated. This avoids the issue of old handlers referring to the inode of the renamed file by always grabbing the current file.