ファイルからロガーを構成していて、.confファイルを変更せずに、代わりにインラインコードを使用して、ログのレベルを変更したいと考えています。
import logging.config
logging.config.fileConfig('..\\LoggingConfig\\loggingfile.conf')
logging.StreamHandler.setLevel(logging.info)
logging.debug("Debug")
logging.info("Info")
これにより、「情報」ログ行のみが画面に出力されます。どのオブジェクトでsetLevel()を呼び出すかわかりません!logging.StreamHandler.setLevel(logging.info)は、30分の検索後の暗闇の中での刺し傷です...
loggingfile.confファイル;
[loggers]
keys=root
[logger_root]
handlers=screen
level=NOTSET
[formatter_modfunc]
format=%(module)-20s %(funcName)-25s %(levelno)-3s: %(message)s
[handlers]
keys=screen
[handler_screen]
class=StreamHandler
formatter=modfunc
level=DEBUG
args=(sys.stdout,)
qualname=screen