[Twisted-Python] can you use log on a service thread

Itamar Shtull-Trauring itamar at itamarst.org
Sun May 30 19:47:44 MDT 2004


On Sun, 2004-05-30 at 07:03, Bill la Forge wrote:

> Is logging thread safe? There seems to be a lot of 
> magic here.

Log observers get called in the thread that calls log.msg(). That is all
there is to it. If you want to make sure observers always run in reactor
thread, you can:

yourObserver = lambda **kwargs: reactor.callFromThread(yourObserver,
**kwargs)

before registering it, or something to that effect.

-- 
Itamar Shtull-Trauring    http://itamarst.org






More information about the Twisted-Python mailing list