[Twisted-Python] can you use log on a service thread
![](https://secure.gravatar.com/avatar/aaeffe5a4cd1c300c46df6b23c7bd1c7.jpg?s=120&d=mm&r=g)
Can you log from a service thread? I looked at log and didn't see any thread locking or anything, except for the following: threadable.synchronize(LogPublisher) threadable.whenThreaded(initThreads) Is logging thread safe? There seems to be a lot of magic here. ===== Bill la Forge http://www.geocities.com/laforge49/ ________________________________________________________________________ Yahoo! India Matrimony: Find your partner online. http://yahoo.shaadi.com/india-matrimony/
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
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
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
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
participants (2)
-
Bill la Forge
-
Itamar Shtull-Trauring