Changing issue title when logging with traceback

When logging a warning with this snippet: (using logging module and SentryHandler)

try:
    that_library.do_something()
except that_library.Error:
    logging.warning('Parse error in that library', exc_info=True)

Title of created issue will be Error. The default generated title may be good in many cases (specially exceptions) but not in this case (a warning with well-written message).

How we can change title of issue to error message (Parse error in that library)?

You cannot choose the titles of issues, as they’re based on the underlying metadata. When you log an error, the issue is the error (not your log message). This is by design, as Sentry isn’t intended to be for arbitrary logging, but rather its goal is to point out issues in your application. The reason we support logging is simply because it’s a clean abstraction that’s already utilized for things like this.

That said, newer versions of some SDKs, Python included, have transaction names which are arbitrary. You’d want to look at how those APIs work, but it might be what you’re looking for.

This is a terrible interface; normal usage of logger.error (warning, etc.) teaches you that the message determines the way the notifications are grouped in the web interface, and there is nothing in the documentation saying: “this will be grouped using the message you provide, except when also collecting the exception information; in that case, the message will NOT be the one you provided, but whatever the caught exception stringifies to”. This trashes message/issue grouping in the web interface.

Please either fix the title determination, or at least document this (IMO, quite unexpected) behaviour.

Sentry is not logging, and we’re not grouping on “the message” unless we are absolutely out of better mechanisms. If you want a logging tool we suggest looking at things like ELK or Papertrail.