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
417 B

6 days ago
# -*- coding: utf-8 -*-
"""票 04:从 logback 的 crm-app.log 提取最近的 ERROR 堆栈。"""
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
txt = open(r'e:\code\crm-backend-matt\logs\crm-app.log', encoding='utf-8', errors='replace').read()
idx = txt.rfind('ERROR')
print('size', len(txt))
if idx >= 0:
print(txt[max(0, idx - 300):idx + 3000])
else:
print(txt[-1500:])