[Twisted-Python] How send information (constructor data?) to a derived protocol

Doug Farrell dfarrell at mypublisher.com
Wed Dec 12 09:29:12 EST 2007

Hi all,


I'm trying to develop a system to handle Python logging messages via the
logging.handlers.sockethandler system. What I want is a to be able to
have multiple Python processes logging to the same log file, as well as
a global log file. I want to do this by having a local logging server
that handles all of the log messages from all of the Python processes
per server. I also want to have a global logging server that handles all
logging messages from all processes from all servers. I've written a
class that derives from Protocol and does the right thing with the log
messages generated by the logging.handler.sockethandler, and I'd like to
use this class for both the local and global servers. On the global
server machine there will be both services running; the local and global


So here's where I finally get to my question. I'd like to use my derived
Protocol class, but I want each instance of it (in the local server and
in the global server) to use a separate logging configuration file. How
do I pass information to my Protocol class so that it configures itself
for the correct logging configuration file? I don't see how to pass
information via the constructor, and I don't see how else to get
information in there. I'm fairly new to Twisted, so maybe I'm missing
something obvious. Any help would be greatly appreciated!




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20071212/5ec44e91/attachment.htm 

More information about the Twisted-Python mailing list