[Twisted-Python] Re: Python 2.3 logging package and Twisted...
Itamar wrote: | > In applications using Twisted.web is writing logs with this | > new module the kind of operation that would need to be done in | > a deferred? | | Uh. It can't be *blocking*. Writing to a log file is fine. Writing to a | socket would block, so don't do that. Using a Deferred doesn't magically | make it not block. | | > I understand there's also twisted.python.log, but the issue | > comes up for applications being moved to Twisted that already | > use external logging libraries. | | You can use it, sure, or whatever library you want, as long as they | don't block. In fact you can hook up logging to t.p.log too if you want | (log.addObserver with a little glue function.) I don't think I asked the original question very clearly. What I should of asked is "has anyone using the new 2.3 logging package found blocking behaviour?". Yes would mean I'd have to handle the logging with a different package. As it turns out, the new logging package can listen on a socket for configuration instructions and it uses threading locks to ensure thread-safety of its shared data structures, so I'm proceeding with caution ;-) Cheers, Stu -- Stuart Hungerford ANU Internet Futures Project
On Tue, 24 Jun 2003 14:35:31 +1000 Stuart Hungerford <stuart.hungerford@anu.edu.au> wrote:
I don't think I asked the original question very clearly. What I should of asked is "has anyone using the new 2.3 logging package found blocking behaviour?". Yes would mean I'd have to handle the logging with a different package.
As it turns out, the new logging package can listen on a socket for configuration instructions and it uses threading locks to ensure thread-safety of its shared data structures, so I'm proceeding with caution ;-)
Locks do not imply non-blocking. From what glyph tells me logging over sockets blocks, do not use them with Twisted unless you do the actual write to the logging thingie in a thread. -- Itamar Shtull-Trauring http://itamarst.org/ http://www.zoteca.com -- Python & Twisted consulting
participants (2)
-
Itamar Shtull-Trauring
-
Stuart Hungerford