1

I would like to flush the log of my Flask application as it is ran by Gunicorn and Supervisord. I found a few options here for supervisord and there specifically for Gunicorn.

The ones for Gunicorn only work for Python 3, is there something that would work with Python 2? In particular, is there a way to pass the -u option to Python when Gunicorn is executing my app?

Julio
  • 11
  • 2
  • do you *have* to use python 2? – Z4-tier Oct 03 '19 at 23:37
  • Well if noone knows I will have to use python 3... But maybe there is a simple way to pass the -u flag when executing Gunicorn – Julio Oct 03 '19 at 23:59
  • If it's new development and not an existing legacy code base, there really is no good reason to not be using python3. Python2 will be officially end-of-life and unsupported on January 1 2020. – Z4-tier Oct 04 '19 at 15:35
  • As for your question, I think there is more information needed. Are you using `print()` statements in your Flask application, and the output is not appearing where you expect? Are you configuring any log handlers within your app? Where are you sending the log data, and where are you expecting it to appear? Are you running this on a stand-alone system, or in a Docker container? – Z4-tier Oct 04 '19 at 15:39
  • Good questions! – Julio Oct 06 '19 at 19:41

1 Answers1

0

I switched from print() to app.logger.info() and I am using the method described in https://medium.com/@trstringer/logging-flask-and-gunicorn-the-manageable-way-2e6f0b8beb2f to get the logs to be stored by supervisord.

Julio
  • 11
  • 2