[Twisted-Python] twisted.python.log usage...

Paul Boehm typo at soniq.net
Fri Sep 26 04:56:07 EDT 2003

On Thu, Sep 25, 2003 at 12:06:07PM -0400, Miguel Marques wrote:
> I know I can call msg with system='servername' everytime but I thought
> that I could have the lass that implements the running worker threads
> inherit from Logger and override logPrefix but that doesn't seem to work.
> I obviously (or so I think) need to insert system='servername' in the ILogContext
> for each of my threads but it isn't all that clear to me how to do that.
> I'm confused (and I don't even have an opulent toilet ;-) )
> TIA for any help...

the way i presume it is supposed to be done, is to use
log.callWithLogger(), which automagically sets up a new context, until
the called method returns.

but logging contexts are at best sparingly used within twisted itself,
and i think the concept either needs rethinking, or at least should be
_used_ in twisted mainline, where it makes sense.

imho Protocols should be their own Loggers by default, because right now
the msg's i write from a protocol appear with the factory's context,
which can be confusing and misleading.

also i think it's a problem with logging, that protocols/factories by
default are not very verbose when a new client has connected.. (has
anything changed since i last looked? do they log anything at all?)


More information about the Twisted-Python mailing list