logger_test

master
xfc 2 years ago
parent db53d8faae
commit 48f4a9da19

@ -162,7 +162,7 @@ REST_FRAMEWORK = {
}
# 配置日志
LOG_DIR = os.path.join(BASE_DIR, 'logs/')
LOG_DIR = os.path.join(BASE_DIR, 'logs')
LOGGING = {
'version': 1, # 保留字
'disable_existing_loggers': False, # 是否禁用已经存在的日志实例
@ -191,13 +191,23 @@ LOGGING = {
'formatter': 'simple',
# 'filename': os.path.join(BASE_LOG_DIR, "tpservice.log")
},
# 'file': {
# 'level': 'INFO',
# 'class': 'concurrent_log_handler.ConcurrentRotatingFileHandler', # window多进程 需要 pip install concurrent-log-handler
# 'filename': os.path.join(BASE_DIR, "logs/debug.log"), # 日志文件
# 'backupCount': 10, # 保留的最大文件数,超过则删除日期最早的
# 'maxBytes': 1024, # 文件大小
# 'formatter': 'standard',
# 'encoding': 'utf-8',
# },
'file': {
'level': 'DEBUG',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': os.path.join(LOG_DIR, 'debug.log'), # 日志文件
'when': "D",
'interval': 1,
'formatter': 'standard'
'level': 'INFO',
'class': 'cloghandler.ConcurrentRotatingFileHandler', # linux多进程 需要 pip install ConcurrentLogHandler
'filename': os.path.join(BASE_DIR, "logs/debug.log"), # 日志文件
'backupCount': 10, # 保留的最大文件数,超过则删除日期最早的
'maxBytes': 1024, # 文件大小
'formatter': 'standard',
'encoding': 'utf-8',
},
},
'loggers': { # 日志实例 记录器

Binary file not shown.
Loading…
Cancel
Save