Set app log level to logging.DEBUG instead of logging.INFO
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 24.4k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 13
Description
Recently I tried using logging to record debugging information in my callbacks via app.logger (see discussion at https://community.plot.ly/t/logging-debug-messages-suppressed-in-callbacks) and found that some debug messages were being ignored, apparently only when they were logged from callbacks.
It turned out that with the default behaviour (i.e. silence_routes_logging=True), debug messages don't get logged after the server is started as Dash sets self.logger.setLevel(logging.INFO) when app.run_server() is called (see https://github.com/plotly/dash/blob/aac493c23366043c3e9612c3f5624ffacbb5d1e9/dash/dash.py#L1162). It's easy to work around, but @ned2 suggested that it might be more sensible for Dash to set its master log level to logging.DEBUG anyway. As an end-user it was not obvious to me why my debug messages were being logged at first and then weren't.
If this would be a sensible change, I'm happy to make a mini-PR.
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 in dash/dash.py at the app.run_server() path referenced by the issue, especially where the logger level is set. Check how silence_routes_logging affects callback messages and identify the relevant logging behavior to verify. Done means debug messages from callbacks remain available after the server starts without requiring an end-user workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100