重订单问题加日志跟踪

This commit is contained in:
wuaho 2021-10-11 19:12:24 +08:00
parent f198c68b4e
commit 80ec356516
2 changed files with 4 additions and 0 deletions

2
app.py
View File

@ -51,6 +51,8 @@ class XProcess(Process):
elif 'track' in type_: elif 'track' in type_:
# continue # continue
if data['#event_name'] == 'pay':
self.log.info(data)
obj = getattr(handler_event, type_) obj = getattr(handler_event, type_)
obj(data) obj(data)
elif type_ == settings.STOP_SIGNAL: elif type_ == settings.STOP_SIGNAL:

View File

@ -80,9 +80,11 @@ class Transmitter:
self.db_client.execute(sql) self.db_client.execute(sql)
self.log.info(f'进程{self.p} 写入耗时 {int(time.time() * 1000) - ts}') self.log.info(f'进程{self.p} 写入耗时 {int(time.time() * 1000) - ts}')
except Exception as e: except Exception as e:
self.log.error(traceback.format_exc())
# 丢弃错误行 再次发送 # 丢弃错误行 再次发送
if hasattr(e, 'code') and e.code == 26: if hasattr(e, 'code') and e.code == 26:
m = re.match('(.*)?Stack trace', e.message) m = re.match('(.*)?Stack trace', e.message)
self.log.error(data)
if m: if m:
error_msg = m.group(1) error_msg = m.group(1)
error_row = re.match('.*?errors out of (\d+) rows', error_msg) error_row = re.match('.*?errors out of (\d+) rows', error_msg)