You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

20 lines
678 B

# -*- coding: utf-8 -*-
"""抓 23:37 导入执行窗口的日志,定位 r1 单行异常根因。"""
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
win = []
for ln in open(r'e:\code\crm-backend-matt\logs\crm-app.log', encoding='utf-8', errors='replace'):
if ' 23:37:0' in ln or ' 23:37:1' in ln:
win.append(ln.rstrip())
print(f'窗口行数 {len(win)}')
show = False
for ln in win:
lv = ln.split('] [')[1][:4] if '] [' in ln else ''
if lv in ('WARN', 'ERROR') or '导入' in ln:
show = True
if show:
print(ln[:400])
if show and ('markFailed' in ln or 'executeImport' in ln):
show = False