سؤال

I'm extending upon the ideas presented in Cody Soyland's blog post on gevent-socketio here: http://codysoyland.com/2011/feb/6/evented-django-part-one-socketio-and-gevent/

But I am having trouble finding where exceptions are being swallowed up. Any errors that occur during the socketio loop seem to dissapear and execution will stop. I've tried using the python logging module as suggested in other threads regarding mod_wsgi but to no avail.

Can anyone help?

هل كانت مفيدة؟

المحلول

This fixed it

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)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top