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.
12 lines
476 B
12 lines
476 B
|
1 week ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 04:从服务日志提取 C1 50001 的堆栈。"""
|
||
|
|
import io, sys
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
txt = open(r'e:\code\crm-backend-matt\logs\t04-run.log', encoding='utf-8', errors='replace').read()
|
||
|
|
# 找最近的 ERROR/Exception 段
|
||
|
|
idx = txt.rfind('ERROR')
|
||
|
|
if idx < 0:
|
||
|
|
idx = txt.rfind('Exception')
|
||
|
|
print('log size=', len(txt))
|
||
|
|
print(txt[max(0, idx - 500):idx + 2500] if idx >= 0 else '(no ERROR found)')
|