When in debug mode, we can add logs with levels higher than error/warning. This works:
current_app.logger.debug("this is a debug log")
However, when in "production" (DEBUG is False), Flask will not change the level of the root logger, see here. As a consequence, any log higher than .error or .warning will not propagate to the specific handlers, so no logging output.
To test this, setting app.logger.setLevel(logging.DEBUG) fixes current_app.logger.debug.
The Flask documentation suggests setting the logging level before app initialization using from logging.config import dictConfig.
When in debug mode, we can add logs with levels higher than error/warning. This works:
However, when in "production" (
DEBUGisFalse), Flask will not change the level of the root logger, see here. As a consequence, any log higher than.erroror.warningwill not propagate to the specific handlers, so no logging output.To test this, setting
app.logger.setLevel(logging.DEBUG)fixescurrent_app.logger.debug.The Flask documentation suggests setting the logging level before app initialization using
from logging.config import dictConfig.