Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Capture python standard output running through gunicorn

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!

like image 939
theicfire Avatar asked Apr 21 '26 22:04

theicfire


1 Answers

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.

like image 89
theicfire Avatar answered Apr 24 '26 10:04

theicfire