user823743
user823743

Reputation: 2172

How to get error messages while using Twisted reactor?

I have implemented a server and several clients using Twisted (in Python). Now, as I develop my server and the code gets more complicated I need to carefully resolve possible bugs. However, because of the Twisted reactor (that's my guess), I never get any error messages, even when there are obvious flaws in the code. I am wondering if there is any best practice or solution for getting error messages on the consule while running a Twisted reactor? Just for your information, I'm using lineReceiver and serverFactory, and defferedToThread to run another thread in parallel to the networking part of the server. Thank you in advance.

Upvotes: 1

Views: 213

Answers (1)

Jean-Paul Calderone
Jean-Paul Calderone

Reputation: 48325

Enable logging.

from twisted.python.log import startLogging
from sys import stdout

startLogging(stdout)

...

Or use twistd which enables it automatically for you.

Upvotes: 1

Related Questions