forked from kongfp/TP_Admin
31
0
Fork 1

exception&log #5

Closed
xufc wants to merge 1 commits from xufc/TP_API:master into master

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

Binary file not shown.
Loading…
Cancel
Save