Python logging and ThreadingTCPServer

Vinay Sajip vinay_sajip at
Sat Oct 18 01:33:49 CEST 2008

On Oct 17, 5:48 pm, Daniel <daniel.watr... at> wrote:
> Hello,
> I building an application that consists of several sockets
> components.  I would like to useloggingin 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

This has come up before. See for example


Vinay Sajip

More information about the Python-list mailing list