-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[Feature Request] Possibility to configure Dash logger level #1354
Comments
We can certainly move the
|
Thanks for the reply @alexcjohnson 🙂
Agree, currently the Dash and Flask messages overlap a bit, so maybe we should simply remove
as you suggest (I think). There still perhaps are use cases for configuring the Dash logger level, so maybe we should do both (removing those two lines + moving the Semi-related: We are silencing the Flask message as well (since that also prints a confusing and not relevant import flask
def silence_flask_startup():
"""Calling this function monkey patches the function flask.cli.show_server_banner
(https://github.com/pallets/flask/blob/a3f07829ca03bf312b12b3732e917498299fa82d/src/flask/cli.py#L657-L683)
which by default outputs something like:
* Serving Flask app "dash_app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
This warning is confusing to new users, which thinks something is wrong
(even though having development/debug mode turned off, and
limit availability to localhost, is best practice wrt. security).
After calling this function the exact lines above are not shown
(all other information/output from the flask instance is untouched).
"""
def silent_function(*_args, **_kwargs):
pass
flask.cli.show_server_banner = silent_function and then use it something like silence_flask_startup()
dash_app.run_server(...) |
Makes sense. Feel like making a PR to both remove that extra log message and move the |
Is your feature request related to a problem? Please describe.
These lines,
dash/dash/dash.py
Lines 1626 to 1632 in 7b189ad
which could be useful for Python developers that at some point want to take their app from
localhost
to production/shared server.However, for other use cases, e.g. when using Dash for building command-line programs with end-user consumption and visualization on
localhost
only, the messages could for some users be confusing (or even scary 😱🙂), since they are non-programmers and seeWarning
,Do not
together with unknown terminology.Describe the solution you'd like
The current log level is set here
dash/dash/dash.py
Line 1354 in 7b189ad
dash/dash/dash.py
Line 1251 in 7b189ad
debug
value inapp.run_server(debug=False/True)
.An easy fix could probably simply be to move
dash/dash/dash.py
Line 1354 in 7b189ad
logger
is initialized in the first place,dash/dash/dash.py
Lines 378 to 379 in 7b189ad
INFO
is the final level regardless ofdebug
value. That would enable Python programs usingdash
to use something liketo set appropriate log level before calling
app.run_server()
.Describe alternatives you've considered
Could also add a new argument to
app.run_server
ordash.Dash.__init__()
with wanted Dash log level.Additional context
There is debug log potentially printed here
dash/dash/dash.py
Lines 707 to 713 in 7b189ad
__init__
throughinit_app()
:dash/dash/dash.py
Lines 378 to 386 in 7b189ad
<= DEBUG
before running Dash to get these logs? If so, the change mentioned above could still support this simply by movingsetLevel
to afterinit_app
:The text was updated successfully, but these errors were encountered: