Can't get Tornado to log any events to Sentry


#1

I have followed the guide at https://docs.sentry.io/clients/python/integrations/tornado/ to try and get Tornado to log unhandled exceptions to Sentry, but errors never make it into Sentry.

I have confirmed that the Sentry DSN is correct.

I made a test handler in Tornado to try and get it to send an event to Sentry:

class RaiseExceptionHandler(tornado.web.RequestHandler, SentryMixin):
    def get(self, *args, **kwargs):
        raise Exception("Test Exception")

and when I call this handler from both a development environment and production environment, an event is never logged in Sentry.

How can I start debugging this issue?


#2

I figured it out.

When creating a Handler in Tornado, SentryMixin must be inherited first, before Tornado’s RequestHandler.

this:

class MyHandler(tornado.web.RequestHandler, SentryMixin):
    pass

becomes this:

class MyHandler(SentryMixin, tornado.web.RequestHandler):
    pass