Log message are missing
chris1248 opened this issue · comments
Our Fast API app uses the python logger in a few places like this:
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
Which we set at the top of the file that uses that logger. It works very well when we run uvicorn locally on our machine.
We get all our logging exactly as we like it.
But
When we run our app in the docker container FROM tiangolo/uvicorn-gunicorn:python3.8-2020-12-19
We get no logging from our app. All our logging statements are completely missing.
All we get is this:
web_1 | ip_address:port - "POST /<endpoint> HTTP/1.1" 200
web_1 | ip_address:port - "POST /<endpoint> HTTP/1.1" 200
What are we missing?
I tried setting the env variable LOG_LEVEL to "debug" but my logging statements were still missing.
I solved it myself. Turns out a logger's .parent was None. Difference between gunicorn and uvicorn. Thus there was no handler for the logger. Taking that into account, I was able to fix it easily myself in my own app.
I'd be curious to know what was the solution you found to this problem!