Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to override the default logger and handler [Feature Request] #1099

Closed
ethagnawl opened this issue Jan 28, 2020 · 0 comments · Fixed by #2425
Closed

Allow users to override the default logger and handler [Feature Request] #1099

ethagnawl opened this issue Jan 28, 2020 · 0 comments · Fixed by #2425

Comments

@ethagnawl
Copy link

I came across unexpected behavior when attaching Dash instances to a Flask application. The logger attached to the Dash app causes log messages sent to my application's logger (e.g. current_app.logger.info('foo')) to be output N+1 times (N=number of Dash applications attached to Flask app).

I was able to work around this by removing the handler added by Dash:

my_dash = dash.Dash(__name__,
    server=app,
    url_base_pathname='/my_dash/',
    assets_folder="../dashboards/foo/bar/assets"
)

if (my_dash.logger.hasHandlers()):
    my_dash.logger.handlers.clear()

Ideally, I'd either be able to opt out of having Dash attach the handler and/or provide a custom logger/handler via a Dash constructor kwarg. I'd be happy to take a pass at submitting a PR if this is something the maintainers would consider.

@ethagnawl ethagnawl changed the title Allow users to override the default logger [Feature Request] Allow users to override the default logger and handler [Feature Request] Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant