sentry-python: Why is tornado.application logger ignored?

It appears Sentry do not report any logs from tornado.application logger

https://github.com/getsentry/sentry-python/blob/master/sentry_sdk/integrations/tornado.py#L53 ignore_logger(“tornado.application”)

However, it seems the default logger used by Tornado to report unhandled exceptions:

https://github.com/tornadoweb/tornado/blob/682ff8dec2d095b339b62d875252be932ae4a5f2/tornado/web.py#L1762

def log_exception(
    self,
    typ: "Optional[Type[BaseException]]",
    value: Optional[BaseException],
    tb: Optional[TracebackType],
) -> None:
    """Override to customize logging of uncaught exceptions.
    By default logs instances of `HTTPError` as warnings without
    stack traces (on the ``tornado.general`` logger), and all
    other exceptions as errors with stack traces (on the
    ``tornado.application`` logger).
    .. versionadded:: 3.1
    """
    if isinstance(value, HTTPError):
        if value.log_message:
            format = "%d %s: " + value.log_message
            args = [value.status_code, self._request_summary()] + list(value.args)
            gen_log.warning(format, *args)
    else:
        app_log.error(  # type: ignore
            "Uncaught exception %s\n%r",
            self._request_summary(),
            self.request,
            exc_info=(typ, value, tb),
        )

How are we supposed to propagate uncaught exceptions in a Tornado based application to Sentry with Tornado integration?

Thanks

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Sorry for not having been clear about this: yes, we do not receive any report in Sentry. I asked our python developper to check locally why the monkeypatch did not work.