Black Lives Matter. Please consider donating to Black Girls Code today.

Suppress Dash server posts to console

Is there a way to surpass the console output of dash? Specifically I have an interval update element and it spams console so much that I can’t decipher my own own output from my python functions that print statuses and intermediate results to console.

This is the default behavior of the logger that Flask uses. Based on this stackoverflow post I found, you can change this default behavior to only produce logs for errors:

import logging
log = logging.getLogger('werkzeug')

nedned, this worked beautifully! Thanks.

1 Like

Is there a way to keep track of these logs in a logs directory rather than just spitting it out to the terminal?

I’m sure you can configure the logger to do that, since Flask just uses the standard Python logger. I would read through the Flask logging docs and then the Python logging docs. I think between those two references there will hopefully be enough info to work it out.

Although I guess it’s really the werkzeug logger that’s relevant here. Here’s an example I found that might be helpful. You might have to modify it to also remove the terminal logger.