[Twisted-Python] Keeping logger from snatching stdout?

Jeff Grimmett grimmtooth at gmail.com
Wed Aug 29 16:48:19 MDT 2018


I'm working on a Flask project using the flask_twisted package from PyPI
and have encountered a mystery.  I don't *have* to solve it to move on, but
darn it, I can't let it go :)

https://pypi.org/project/Flask-Twisted/
https://github.com/cravler/flask-twisted/

So here's the breakdown: when use the standard logging module to output to
a logfile + stdout, everything is fine.  I do see some logging output from
Twisted as well (the web server part) but for the most part life is groovy.

I'm going to be integrating in a wxPython windows app to this (previously
it's been a shell app) and step 1 was to make my own stdout handler that
eventually would pipe all that stuff to a window in the wx app.  The first
step of THAT (step 1.a) was to replace all the logging stuff with print()
placeholders.

At that point, things got confusing, as now ALL of my print()s are being
handled by Twisted's logging handler.

I brought flask-twisted in local to my code so I could monkey around with
it. First thing I noticed was that it was using twisted.python.log. I
messed around with that - commented it out, and now I get no stdout output
at all.  Set the parameter setStdout to False, same thing.

The adapter code uses twisted.internet.reactor,  threads,
twisted.web.server.Site, twisted.web.wsgi.WSGIResource, and
twisted.web.resource.Resource, any one which might be responsible. I spent
yesterday evening digging around but haven't found anything yet.

Any guidance / ideas?

Regards,

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20180829/ee0f7b76/attachment.html>


More information about the Twisted-Python mailing list