Python logging and ThreadingTCPServer

D

Daniel

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
 
V

Vinay Sajip

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

http://groups.google.com/group/comp.lang.python/browse_thread/thread/3fbd36c89119f27f

Regards,

Vinay Sajip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top