With my Procfile like this:
web: gunicorn app:app \
--bind "$HOST:$PORT" \
--error-logfile "-" \
--enable-stdio-inheritance \
--reload \
--log-level "debug"
is it in any way possible to get python print
statements to be logged to stdout / bash? I am using the bottle
framework here as well, if that affects anything.
It turns out the print
statements were actually getting through, but with delay.
The gunicorn docs for --enable-stdio-inheritance note to set the PYTHONUNBUFFERED
, which I thought I had, but it seems with wrong syntax.
I solved it using a .env
file with my foreman
setup to set the variable like this:
PYTHONUNBUFFERED=TRUE