If you use settings.py to specify the logging configuration, and you are running django development server, run it with “–noreload” option may help, i.e.
The reason is that by default, two processes of Django servers are running. One is the actual server, while the other is to detect changes in the code and reload the server. Therefore, settings.py is imported twice, and consequently the two processes are accessing the log file at the same time.
Warning: the following is irrelavent.
I found out this simple solution through hours of googling.
At one point, I thought this was because file handles are inherited by child processes in Python, and I even tried to overwrite the __builtin__.open() function.
I also checked out ConcurrentLogHandler, and thought about writing my own log handler that uses socket.
Finally, this answer enlightened me. I never knew settings.py was imported twice by Django development server!
Post the answer to your own question if you find out the solution. Someone may thank you one day, denvercoder9.
The most obvious solution is most easily neglected.