Log messages appearing twice with Python Logging after pio.renderers.default = "notebook"
Open
Nobody has claimed this yet.
bug
P2
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
After importing plotly.io and setting the pio.renderers.default = "notebook" in my Python code, All Log messages appearing twice with Python Logging
python version: 3.9.12
plotly version: 6.1.2
import logging
# create logger
logger = logging.getLogger('simple_example')
logger.setLevel(logging.DEBUG)
# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
# create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# add formatter to ch
ch.setFormatter(formatter)
# add ch to logger
logger.addHandler(ch)
## print some message
logger.info("hello test") #### till this point all looks good
## now import plotly
import plotly.io as pio
pio.renderers.default = "notebook"
## use the logger again , now the same logger.info printing the log message twice
logger.info("hello test after import")
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the issue's Python logging example, especially the import of plotly.io and setting of pio.renderers.default to "notebook". Trace the renderer setup and logging handlers to identify why the second logger.info call is emitted twice; done means the message appears once after notebook renderer selection and the behavior has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, plotly, python
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100