Don't configure the root logger
See original GitHub issueAs of today, importing dynaconf configures the handlers in the logging
root logger, which renders the basicConfig
useless:
This function does nothing if the root logger already has handlers configured for it.
Example:
>>> import logging
>>> logging.basicConfig(format="[%(asctime)s|%(levelname)s] %(message)s",
... datefmt="%Y-%m-%dT%H:%M:%S")
>>> logging.error("Something")
[2018-06-23T18:21:03|ERROR] Something
The collateral effect of importing dynaconf
:
>>> import logging
>>> import dynaconf
>>> logging.basicConfig(format="[%(asctime)s|%(levelname)s] %(message)s",
... datefmt="%Y-%m-%dT%H:%M:%S")
>>> logging.error("Something")
2018-06-23 18:21:59,723 - root - ERROR - Something
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Don't configure the root logger · Issue #71 - GitHub
As of today, importing dynaconf configures the handlers in the logging root logger, which renders the basicConfig useless: This function ...
Read more >Why you're doing logging in python wrong. | by Mike Taylor
A very common convention I've seen over the last few years in utilizing python logging is to use the root logger: This is...
Read more >Python logging: How can i use the root logger when no logger ...
I have configured logging using a yaml cfg file: version: 1 disable_existing_loggers: true formatters: default: format: "[%(process)d] ...
Read more >Configuring Logging - Quarkus
As we don't change the root logger, console log will only contain INFO or higher order logs. Named handlers attached to a category....
Read more >Configuring loggers · The logback manual - dennis-xlc
Setting the level of a logger or root logger is as simple as declaring it and setting its level, as the next example...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Sytten done! https://pypi.org/project/dynaconf/
Hey @rochacbruno do you think you could do a release soon? Thanks 😃