pyhton logging 配置文件.

[loggers]

keys=root,infoLogger

[logger_root]

level=DEBUG

handlers=consoleHandler,fileHandler

[logger_infoLogger]

handlers=consoleHandler,fileHandler

qualname=infoLogger

propagate=0

[handlers]

keys=consoleHandler,fileHandler

[handler_consoleHandler]

class=StreamHandler

level=INFO

formatter=form01

args=(sys.stdout,)   # 此处,不可少

[handler_fileHandler]

class=FileHandler

level=INFO

formatter=form01

args=('runlog.log','a','utf-8')  # utf-8 必须在后面

[formatters]

keys=form01

[formatter_form01]

format=%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s

你可能感兴趣的:(pyhton logging 配置文件.)