Commit 0bad30db authored by 肖伟's avatar 肖伟

修改依赖和日志设置

parent 973374a0
......@@ -215,23 +215,23 @@ LOGGING = {
# 默认记录所有日志
'default': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(log_path, 'all-{}.log'.format(time.strftime('%Y-%m-%d'))),
'maxBytes': 1024 * 1024 * 5, # 文件大小
'backupCount': 5, # 备份数
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': os.path.join(log_path, 'log.log'),
'when':'D',
'interval':1,
'formatter': 'standard', # 输出格式
'encoding': 'utf-8', # 设置默认编码
},
# 输出错误日志
'error': {
'level': 'ERROR',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(log_path, 'error-{}.log'.format(time.strftime('%Y-%m-%d'))),
'maxBytes': 1024 * 1024 * 5, # 文件大小
'backupCount': 5, # 备份数
'formatter': 'standard', # 输出格式
'encoding': 'utf-8', # 设置默认编码
},
# 'error': {
# 'level': 'ERROR',
# 'class': 'logging.handlers.RotatingFileHandler',
# 'filename': os.path.join(log_path, 'error-{}.log'.format(time.strftime('%Y-%m-%d'))),
# 'maxBytes': 1024 * 1024 * 5, # 文件大小
# 'backupCount': 5, # 备份数
# 'formatter': 'standard', # 输出格式
# 'encoding': 'utf-8', # 设置默认编码
# },
# 控制台输出
'console': {
'level': 'DEBUG',
......@@ -239,15 +239,15 @@ LOGGING = {
'formatter': 'standard'
},
# 输出info日志
'info': {
'level': 'INFO',
'class': 'logging.handlers.RotatingFileHandler',
'filename': os.path.join(log_path, 'info-{}.log'.format(time.strftime('%Y-%m-%d'))),
'maxBytes': 1024 * 1024 * 5,
'backupCount': 5,
'formatter': 'standard',
'encoding': 'utf-8', # 设置默认编码
},
# 'info': {
# 'level': 'INFO',
# 'class': 'logging.handlers.RotatingFileHandler',
# 'filename': os.path.join(log_path, 'info-{}.log'.format(time.strftime('%Y-%m-%d'))),
# 'maxBytes': 1024 * 1024 * 5,
# 'backupCount': 5,
# 'formatter': 'standard',
# 'encoding': 'utf-8', # 设置默认编码
# },
},
# 配置用哪几种 handlers 来处理日志
'loggers': {
......@@ -259,7 +259,8 @@ LOGGING = {
},
# log 调用时需要当作参数传入
'log': {
'handlers': ['error', 'info', 'console', 'default'],
# 'handlers': ['error', 'info', 'console', 'default'],
'handlers': [ 'console', 'default'],
'level': 'INFO',
'propagate': True
},
......
......@@ -683,18 +683,18 @@ def case_logs(request):
log_file_list = os.listdir(logs_path)
data_list = []
file_list = []
now = time.strftime('%Y-%m-%d')
for file in log_file_list:
if 'all' in file and now in file:
file_list.append(file)
if not file_list:
yesterday = datetime.today() + timedelta(-1)
yesterday_format = yesterday.strftime('%Y_%m_%d')
for file in log_file_list:
if 'all' in file and yesterday_format in file:
file_list.apppend(file)
file_list.sort()
log_file = os.path.join(logs_path, file_list[0])
# now = time.strftime('%Y-%m-%d')
# for file in log_file_list:
# if 'all' in file and now in file:
# file_list.append(file)
# if not file_list:
# yesterday = datetime.today() + timedelta(-1)
# yesterday_format = yesterday.strftime('%Y_%m_%d')
# for file in log_file_list:
# if 'all' in file and yesterday_format in file:
# file_list.apppend(file)
# file_list.sort()
log_file = os.path.join(logs_path, 'log.log')
with open(log_file, 'rb') as f:
off = -1024 * 1024
if f.tell() < -off:
......
......@@ -23,7 +23,7 @@ importlib-metadata==1.7.0
kiwisolver==1.2.0
kombu==3.0.37
Markdown==3.1.1
matplotlib==3.1.0
matplotlib==3.4.1
Naked==0.1.31
numpy==1.19.2
Pillow==7.2.0
......@@ -45,3 +45,4 @@ text-unidecode==1.3
urllib3==1.21.1
vine==1.3.0
zipp==3.1.0
dwebsocket==0.5.12
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment