log日志的配置
log日志的配置文件:
注意:修改日志路径,如:
args=('e:\\AutoTestLog.log', 'a', 10*1024*1024, 5)
args=('e:\\AutoTestLog.log', 'a')
Logger.conf文件
################################################ ###########propagate 是否继承父类的log信息,0:否 [loggers] keys=root,example01,example02 [logger_root] level=DEBUG handlers=hand01,hand02 [logger_example01] handlers=hand01,hand02 qualname=example01 propagate=0 [logger_example02] handlers=hand01,hand03 qualname=example02 propagate=0 ############################################### [handlers] keys=hand01,hand02,hand03 [handler_hand01] class=StreamHandler level=DEBUG formatter=form01 args=(sys.stderr,) [handler_hand02] class=FileHandler level=DEBUG formatter=form01 args=('e:\\AutoTestLog.log', 'a') [handler_hand03] class=handlers.RotatingFileHandler level=INFO formatter=form01 args=('e:\\AutoTestLog.log', 'a', 10*1024*1024, 5) ############################################### [formatters] keys=form01,form02 [formatter_form01] format=%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s datefmt=%Y-%m-%d %H:%M:%S [formatter_form02] format=%(name)-12s: %(levelname)-8s %(message)s datefmt=%Y-%m-%d %H:%M:%S
一切技术都是为业务服务,脱离业务的技术一文不值!