简体   繁体   中英

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.

Enable logging.

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

startLogging(stdout)

...

Or use twistd which enables it automatically for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM