Coexistence of Flask logging and other module logging

It seems that the Flask side is set by default_handler of Flask's logger, so you can share it.

my_module.py

from logging import getLogger
logger = getLogger(__name__)

app.py

from logging import DEBUG
from flask.logging import default_handler
import my_module
my_module.logger.setLevel(DEBUG)
my_module.logger.addHandler(default_handler)

app = Flask(__name__)

Ref Logging — Flask Documentation (1.0.x) Logging HOWTO — Python 3.8.1rc1 documentation

Recommended Posts

Coexistence of Flask logging and other module logging
Coexistence of pyenv and autojump
Coexistence of Python2 and 3 with CircleCI (1.0)
Installation of Python3 and Flask [Environment construction summary]
Coexistence of Anaconda 2 and Anaconda 3 in Jupyter + Bonus (Julia)
[Python] A rough understanding of the logging module
[Python] Class type and usage of datetime module
Sample of getting module name and class name in Python
__future__ module and future_builtins module
Suppress python3 flask logging
[Python of Hikari-] Chapter 08-03 Module (Import and use of standard library)
Hook to the first import of the module and print the module path