滚动写入时有文件被其它进程使用的错误
config.json
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"default": {
"()": "uvicorn.logging.DefaultFormatter",
"fmt": "%(levelname)s %(asctime)s %(message)s",
"use_colors": null
},
"access": {
"()": "uvicorn.logging.AccessFormatter",
"fmt": "%(levelname)s %(asctime)s %(client_addr)s - \"%(request_line)s\" %(status_code)s"
}
},
"handlers": {
"default": {
"formatter": "default",
"class": "logging.StreamHandler",
"stream": "ext://sys.stderr"
},
"access": {
"formatter": "access",
"class": "logging.handlers.TimedRotatingFileHandler",
"filename": "./logs/logs.log",
"when": "M",
"interval": 2,
"backupCount": 7
}
},
"loggers": {
"uvicorn": {"handlers": ["default"], "level": "INFO", "propagate": false},
"uvicorn.error": {"level": "INFO"},
"uvicorn.access": {"handlers": ["access"], "level": "INFO", "propagate": false}
}
}