Modified files
storeapi/logging_conf.py
---
+++
@@ -14,6 +14,11 @@
"datefmt": "%Y-%m-%dT%H:%M:%S",
"format": "%(name)s:%(lineno)d - %(message)s",
},
+ "file": {
+ "class": "logging.Formatter",
+ "datefmt": "%Y-%m-%dT%H:%M:%S",
+ "format": "%(asctime)s.%(msecs)03dZ | %(levelname)-8s | %(name)s:%(lineno)d - %(message)s",
+ },
},
"handlers": {
"default": {
@@ -21,11 +26,20 @@
"level": "DEBUG",
"formatter": "console",
},
+ "rotating_file": {
+ "class": "logging.handlers.RotatingFileHandler",
+ "level": "DEBUG",
+ "formatter": "file",
+ "filename": "storeapi.log",
+ "maxBytes": 1024 * 1024, # 1 MB
+ "backupCount": 2,
+ "encoding": "utf8",
+ },
},
"loggers": {
- "uvicorn": {"handlers": ["default"], "level": "INFO"},
+ "uvicorn": {"handlers": ["default", "rotating_file"], "level": "INFO"},
"storeapi": {
- "handlers": ["default"],
+ "handlers": ["default", "rotating_file"],
"level": "DEBUG" if isinstance(config, DevConfig) else "INFO",
"propagate": False,
},