gpt4 book ai didi

python - Django:使用 gevent-socketio 和 WSGIHandler 时捕获/记录异常

转载 作者:太空宇宙 更新时间:2023-11-03 14:33:55 25 4
gpt4 key购买 nike

我在这里扩展了 Cody Soyland 关于 gevent-socketio 的博客文章中提出的想法:http://codysoyland.com/2011/feb/6/evented-django-part-one-socketio-and-gevent/

但我无法找到异常被吞没的位置。 socketio 循环期间发生的任何错误似乎都消失了,执行将停止。我已经尝试按照其他关于 mod_wsgi 的线程中的建议使用 python 日志记录模块,但无济于事。

有人能帮忙吗?

最佳答案

这修好了

import sys
import traceback
from django.core.signals import got_request_exception

def exception_printer(sender, **kwargs):
print >> sys.stderr, ''.join(traceback.format_exception(*sys.exc_info()))

got_request_exception.connect(exception_printer)

关于python - Django:使用 gevent-socketio 和 WSGIHandler 时捕获/记录异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5414409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com