Log gunicorn errors to API service log file #607
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request fixes a bug / race I found while testing the recent package changes.
Right now if an error occurs in a gunicorn powered API service before API service logging if fully initialized, this error will be simply ignored.
This is of course problematic, because those errors usually mean fatal configuration errors which makes troubleshooting hard (no error is logged, yet service doesn't start or similar).
This pull request fixes that by passing
--error-logfile
argument to the gunicorn process (http://docs.gunicorn.org/en/stable/settings.html#errorlog). This way we log gunicorn errors to the existing API service log file.Initially I thought we may need to use a different log file, but I tested it and re-using existing API log file seems to work fine.
Before (there was nothing in the log file yet the service crashed and failed to start):
After: