[Twisted-Python] Logging observers and threads
Itamar Turner-Trauring
itamar at itamarst.org
Thu Jul 12 05:32:25 MDT 2012
On 07/12/2012 05:17 AM, Tristan Seligmann wrote:
> 3) log observers should expect to be inovked in non-reactor threads,
> making this a Mantissa bug.
>
In theory this is the case - the logging howto says "The observer needs
to be thread safe if you anticipate using threads in your program." The
API docs don't mention threads, though..
In practice however, probably every custom observer gets this wrong, so
we really need some infrastructure to make this easier or to fix it.
Possibly we should have some way to indicate an observer is thread-safe,
assume by default they are not, and if they are not wrap them in a
reactor.callFromThread wrapper.
I would also like some infrastructure to make the file log observer run
in its own thread, but that's almost the opposite use case :)
-Itamar
More information about the Twisted-Python
mailing list