LoginSignup
0
0

More than 3 years have passed since last update.

Python3 logging.basicConfigが効かない

Posted at

チェックすること

  • プログラムの実行はpython3で行われているか?
    • python --version
    • あるいは明示的にpython3を用いる
  • 意図せず他のファイルなどで複数basicConfigを定義していないか?
    • 下記コードの場合,ログはファイルに吐かれず標準出力に表示される
main.py
import mycode1
import logging

logging.basicConfig(filename='test.log', level=logging.DEBUG)
logging.debug('test log at test.log')

mycode1.py
import logging

logging.basicConfig(level=logging.DEBUG)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0