Capture python standard output running through gunicorn


Question

I've got a flask app that gives me output like 127.0.0.1 - - [27/Nov/2012 20:56:33] "GET / HTTP/1.1" 200 -

How do I get this written to a file? I know I could run python app.py > blah.log, but how do I do the same thing with gunicorn running? Who is taking the output? I've noticed that looking at gunicorn's logs, it only has information about starting up and not about actual http requests.

Thanks!

1
2
11/28/2012 1:59:09 AM

Accepted Answer

Figured out my problem. The logging page on flask is what I'm looking for: http://flask.pocoo.org/docs/errorhandling/

What I missed in reading this is that the errors are logged to a file only in production mode.

3
11/30/2012 11:27:41 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon