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.

22 lines
970 B

1 week ago
# -*- coding: utf-8 -*-
"""票 06 排障 2:B 商机字段(create 原貌)+ 时间戳 + crm-app.log 堆栈。"""
import io, sys
import pymysql
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
database='crm', charset='utf8mb4', autocommit=True)
cur = conn.cursor()
cur.execute("SELECT opp_name, opp_source, bid_form, province_code, city_code, locality_type, "
"create_time, update_time FROM opportunity WHERE id IN (749194015018057728, 749194037692465152)")
for r in cur.fetchall():
print('[opp]', r)
conn.close()
print('\n--- crm-app.log: ERROR/Exception tail ---')
txt = open(r'e:/code/crm-backend-matt/logs/crm-app.log', encoding='utf-8', errors='replace').read()
print('len=', len(txt))
# 找最后一段 ERROR 堆栈
idx = txt.rfind('ERROR')
print(txt[max(0, idx - 500):idx + 3500] if idx >= 0 else txt[-3000:])