I am running Pylons on my local machine with paster, and on a Debian server using WSGI. I want to add some print statements to debug a problem: am not a Pylons or Python expert.
On my local machine this works开发者_如何学编程 fine: print statements go to the terminal. On the server, the statements don't print to the log files: instead the log file says "IOError: failed to write data" whenever a print statement is called.
Until I can fix this, I can't debug anything on the server.
Could someone advise how to get printing running on the server? Thanks!
It's wrong for a WSGI application to use sys.stdout
or sys.stderr
. If you want to spit debug to a server error log, use environ['wsgi.errors'].write()
.
Don't use print statements, use the logging module. We can't help you without knowing the setup of the server.
精彩评论