RotatingFileHandler and race conditions

Viewed 74

I use RotatingFileHandler and I noticed that when several processes write to it at the same time, each of them rotates the file, so instead of 10MB Foo.log.1 and a new Foo.log, I get a bunch of tiny Foo.log.1, Foo.log.2, Foo.log.3 &c, and my 10MB of history is now completely gone.

Is this a known bug?

How do people deal with this?

1 Answers

The solution is to use WatchedFileHandler and rotate the log file, if necessary, when the logger is created.

Related