[Twisted-Python] twistd/tac : when does logging start?

Luke Marsden luke-lists at hybrid-logic.co.uk
Wed Nov 2 07:48:01 EDT 2011

On Wed, 2011-11-02 at 04:38 -0700, Tobias Oberstein wrote:
> I've got a Twisted application started via a tac file.
> Within the tac, I also initialize a database and create a db pool for use with adbapi.
> Now it seems that log messages from the network services are logged, but not from the initial DB setup stuff.
> When exactly does Twistd start the logging? How can I make it start logging from the very beginning?
> I've looked at the docs:
> "Before startLogging is called, log messages will be discarded and errors will be written to stderr."
> "If you are using twistd to run your daemon, it will take care of calling startLogging for you, ..."
> but that doesn't help me.
> Any hints are welcome

Hi Tobias,

You need to do your intialisation (database connections, etc) in a
startService method of your application, rather than (as you're probably
doing) in the __init__ method.

Hope this helps.

Best Regards,
Luke Marsden
CTO, Hybrid Logic Ltd.

Web: http://www.hybrid-cluster.com/
Hybrid Web Cluster - cloud web hosting

Mobile: +447791750420 (UK) / +1-415-449-1165 (US)

More information about the Twisted-Python mailing list