🔖

Pythonでログをファイルに出力する

に公開
import logging

logging.basicConfig(level=logging.INFO, filename="/var/log/app.log")

logging.info("var/log/app.logにInfoのログを出力")

https://docs.python.org/ja/3/howto/logging.html

Discussion