ファイルからロガーを設定しましたが、.confファイルを変更せずにインラインコードを使用してロギングのレベルを変更したいと思います。python fileConfig loggerのレベルを変更してください
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
グレート、私はインスタンスを取得する方法を知っているために必要な、 '' loggerInstance = logging.getLogger(__ __名)を使用し、感謝! –
私はあなたを助けることができる嬉しい:) – cfedermann
ありがとう非常に有用 – rbp