Sentry 问题

2015-08-13 20:17:22 +08:00
 sbmzhcn
在服务器上装好了sentry客户端用一个测试代码,根据这个来的
http://raven.readthedocs.org/en/latest/integrations/logging.html

logger.error('There was some %s error', 'crazy')

这样没有问题,服务器端登陆网页能看到信息被记录下来,但如果这样

logger.error('There was some crazy error', exc_info=True)
就会出现这样的错误:

```
Top level Sentry exception caught - failed creating log record
b'There was some crazy error'
b'Traceback (most recent call last):\n File "C:\\Python33\\lib\\site-packages\\raven\\handlers\\logging.py", line 59, in emit\n self.format(record)\n File "C:\\Python33\\lib\\logging\\__init__.py", line 808, in format\n return fmt.format(record)\n File "C:\\Python33\\lib\\logging\\__init__.py", line 554, in format\n record.exc_text = self.formatException(record.exc_info)\n File "C:\\Python33\\lib\\logging\\__init__.py", line 504, in formatException\n traceback.print_exception(ei[0], ei[1], tb, None, sio)\n File "C:\\Python33\\lib\\traceback.py", line 156, in print_exception\n for value, tb in values:\n File "C:\\Python33\\lib\\traceback.py", line 122, in _iter_chain\n context = exc.__context__\nAttributeError: \'NoneType\' object has no attribute \'__context__\'\n'
Sentry is attempting to send 1 pending error messages
Waiting up to 10 seconds
Press Ctrl-Break to quit
```

请问是怎么回事
3611 次点击
所在节点    Python
5 条回复
shellfly
2015-08-13 20:43:53 +08:00
文档上不是说了,只有当你真的是在catch一个异常的时候才用这个参数,否则应该用另一种方式来获取堆栈信息
sbmzhcn
2015-08-13 22:28:16 +08:00
@shellfly try : except 吗, 我试了还是不行
sbmzhcn
2015-08-13 22:32:33 +08:00
logger.error('Exception in method ...', exc_info=True, extra=dict(stack=True)) 这样就行了,谢了。
lequiet
2015-08-14 00:07:54 +08:00
原来Logger有参数获得这个信息,学习了
ivanlw
2015-08-14 02:30:28 +08:00
Sentry是…真眼?? #dota2

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/213039

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX