Skip to content

logistro.getLogger() adds logging handler #238

@adamgreg

Description

@adamgreg

When Kaleido or Choreographer modules call logistro.getLogger() upon import, it will automatically call logging.basicConfig() if the root logger does not have handlers already, creating a stderr handler.

This causes surprising behaviour for applications that use Kaleido or Choreographer. If they set up their logging handlers after the import, they may end up with two console logging handlers. This can be particularly confusing when it's triggered by a dynamic import in plotly - see plotly/plotly.py#5247.

Setting up logging handlers is usually a responsibility of the application, not its dependencies. It could be prevented here by replacing calls to logistro.getLogger() with logging.getLogger(). You would have a MyPy issue though, because it won't know that the log type is _LogistroLogger without a typing.cast call.

I'll try raising a PR to Logistro to add a kwarg to logistro.getLogger() to stop it adding the handler.

Kaleido issue: plotly/Kaleido#356

Metadata

Metadata

Assignees

Labels

P2needed for current cyclebugsomething broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions