Skip to content

Log messages appearing twice with Python Logging after pio.renderers.default = "notebook" #5247

Open
@anstiwar

Description

@anstiwar

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")

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions