Python logging and ThreadingTCPServer

Daniel daniel.watrous at gmail.com
Fri Oct 17 18:48:25 CEST 2008


Hello,

I building an application that consists of several sockets
components.  I would like to use logging in them, but I've noticed
some issues with the logs getting mangled.  This mangling seems to
happen when different threads attempt to access the same log file.

For example, if a client and a server component are running on the
same box and both try to write to the same physical log file, the
first will write fine, but when the second thread (or process) writes
to the log file it mangles the first part of the log file including
deleting some of the information and adding various strange characters
and space.  Sometimes it seems that the first process never is able to
write to the log file after the second process starts writing.

Is this a known issue/bug?  Are there any known workarounds?

Thanks,
Daniel



More information about the Python-list mailing list