Closed vitekzach closed 4 years ago
Hi - I’ve never tried to do this, so I’ll have to look into it and get back to you :)
Hi,
I stumpled over this issue, because I faced the same error during my project, where I use Gunicorn + Flask inside a Docker container. I use a gunicorn-config.py which loads
with open('gunicorn_logging.yaml', 'rt') as file:
log_config = yaml.safe_load(file.read())
logconfig_dict = log_config
After upgrading to Gunicorn 20.0.4 I always got the error:
Error: Unable to configure root logger
Solution: I added
root:
level: INFO
handlers: [default]
propogate: yes
to my YAML and now it works again.
I assume the root logger needs to be on the top level of your logging dictionary. https://docs.python.org/3/library/logging.config.html#logging.config.dictConfig
The dictionary passed to dictConfig() must contain the following keys:
- version
- loggers
- root
Hi - thank you, this completely fell off my task list and I’m sorry for not getting back to you both sooner!
I’ll update the documentation to mention this 😃
I just realised that the example in the docs already includes the root
element. I'm closing this issue for now, but feel free to reopen if you need to :)
Description
Describe what you were trying to get done. I have a python app running in a Docker container using flask and gunicorn to deploy it. I would like to have not only in-app logs to be logged in seq, but also the web-server logs (coming from gunicorn).
Tell us what happened, what went wrong, and what you expected to happen. I tried to use the logconfig_dict parameter to configure the logging for the gunicorn server, but it fails.
What I Did
Here is the gunicorn config file I was using:
I get following error:
Error: Unable to configure root logger
Before it was failing on the console handler.
Is it possible to take advantage of the seq logger to set up logging this way? Is there another way I can achieve this? I would like to keep the console logging as well, except it was failing too for to me an unknown reason.
Thanks!