1.日志先这样用吧
import logging # 配置日志输出路径 logging_file = "E://w.log" LOGGING_CONF_DICT = { "filename": logging_file, "level": logging.DEBUG, "format": "%(levelname)s " "%(filename)s " "%(module)s " "%(funcName)s " "line:%(lineno)d " "%(asctime)s " "%(message)s", "datefmt":"%Y-%m-%d %H:%M:%S" } logging.basicConfig( **LOGGING_CONF_DICT ) logger = logging.getLogger("main") def main(): logger.warning("aaaaaaaaaaaaaaaaaaaaaa") if __name__ == '__main__': main()