[Fedora-suds-list] Multithreading logging help

Ernest Folch Espallargas ernest.folch at neomobilegroup.com
Wed Jun 2 15:51:09 UTC 2010


Hi all,

I'm developing a Pylons app to send sms throught all Spanish mobile operators. 
In fact, I developed one plugin for each mobile operator. In two of them I'm 
using the Suds library to implement the client for consuming operators web 
services. I'm usgin the logging to get all the XMLs sended to and from the 
operators on differents files, one for each operator. To get the logs, on the 
top of each plugin I have this code: 
logging.getLogger('suds.client').setLevel(logging.DEBUG) and then I redirect 
this suds logs to files using an specific logger handler (differents files for 
different plugins).

When I start the firts plugin I get the logs on the file number 1. When I 
start the second plugin I get the logs on the file number2. It's correct, but 
the problem appears when I start the two plugins concurrently because I get 
the logs mixed on file1 and on file2.

I look python documentation about logging.getLogger function to found the 
problem and I found it:

"getLogger() returns a reference to a logger instance with the specified if it 
it is provided, or root if not. The names are period-separated hierarchical 
structures. Multiple calls to getLogger() with the same name will return a 
reference to the same logger object. Loggers that are further down in the 
hierarchical list are children of loggers higher up in the list"

The real  problem is that all the plugins are getting the same instance 
reference for the logging and for that the logs goes to the last file defined. 
It's possible to solve this issue? How I can get with Suds library the logs on 
separated files on the same app?

On our computer we have installed:

python-2.6-9.fc11.x86_64
python-suds-0.3.7-1.fc11.noarch
python-pylons-0.9.7-1.fc11.noarch

Thanks in advance for your help!!
Ernest


More information about the suds mailing list