|
@@ -23,7 +23,7 @@ class BaseConfig(object):
|
|
|
|
|
|
dictConfig({
|
|
|
"version": 1,
|
|
|
- "disable_existing_loggers": False, # 不覆盖默认配置
|
|
|
+ "disable_existing_loggers": True, # 不覆盖默认配置
|
|
|
"formatters": { # 日志输出样式
|
|
|
"default": {
|
|
|
"format": "%(asctime)s - %(module)s.%(lineno)d - %(levelname)s - %(threadName)s: %(message)s"
|
|
@@ -36,13 +36,14 @@ dictConfig({
|
|
|
"formatter": "default",
|
|
|
},
|
|
|
"log_file": {
|
|
|
- "class": "logging.handlers.RotatingFileHandler",
|
|
|
- "level": "INFO",
|
|
|
+ "class": "logging.handlers.TimedRotatingFileHandler", # 按时间切分日志
|
|
|
+ "level": "DEBUG",
|
|
|
"formatter": "default", # 日志输出样式对应formatters
|
|
|
"filename": "./logs/flask.log", # 指定log文件目录
|
|
|
- "maxBytes": 20*1024*1024, # 文件最大20M
|
|
|
- "backupCount": 10, # 最多10个文件
|
|
|
- "encoding": "utf8", # 文件编码
|
|
|
+ "when": "midnight", # 按天切分,午夜时分创建新文件
|
|
|
+ "interval": 1, # 间隔1天
|
|
|
+ "backupCount": 10, # 保留10天的日志文件
|
|
|
+ "encoding": "utf8", # 文件编码
|
|
|
},
|
|
|
|
|
|
},
|