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

Greetings... I've just started using twisted and I have a question about logging. I have a server which uses twisted.python.log. I open a file and then call log.startLogging with it. I then start a number of worker threads and then instantiate an Application and run it. All log.msg from the main program have the server name I passed when I instantiaed the Application. When I call log.msg from the threads the name is just [-]. 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... Miguel C. Miguel Marques, Development Services, Computing and Network Services, York University e-mail: miguel at yorku.ca, voice: (416)736-2100x22684, fax: (416)736-5830

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?) paul
participants (2)
-
Miguel Marques
-
Paul Boehm