question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't configure the root logger

See original GitHub issue

As 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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rochacbrunocommented, Jul 29, 2018
1reaction
Syttencommented, Jul 28, 2018

Hey @rochacbruno do you think you could do a release soon? Thanks 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found