ptou
ptou

Reputation: 323

supervisor (with gunicorn) stops logging after http error 500

I am using supervisor (3.2.0-2ubuntu0.1) to manage gunicorn with this very common configuration:

[program:app]
command = sudo gunicorn -w 1 -b 0.0.0.0:8000 application:app --error-logfile /var/log/gunicorn/error.log --access-logfile /var/log/gunicorn/access.log
directory = /home/ubuntu/app
user = ubuntu

Supervisor captures correctly logs from gunicorn and gunicorn generates correctly its own logs.

However, as soon as there is a 500 in the underlying api served by gunicorn, supervisor stops capturing the logs (while gunicorn captures correctly the issue in its error.log).

How do I fix this?

Upvotes: 1

Views: 162

Answers (1)

ptou
ptou

Reputation: 323

Turns out the issue was with the worker in python itself. If you try to log something that the logger cannot interpret, the logger becomes foobared and any further attempt to log is doomed.

Upvotes: 1

Related Questions