Description
Problem Statement
We have a Django application that catches all exceptions through django-rest-framework's exception handler functionality, followed by logging them through a logging.getLogger().exception()
call.
We've set the ignore_errors
option to not create Sentry issues for some exceptions, but we'd still like for those exception logs to be sent to Sentry Structured Logs. However, it seems like those logs are prevented from being sent by the standard ignore_errors
mechanism.
We can of course replace the previously mentioned exception()
call with a call to logging.getLogger().error()
(and not provide exc_info
), but that seems like a suboptimal solution, as using exception()
is (probably) the most idiomatic way to log exceptions.
Solution Brainstorm
Maybe add a new option to sentry_sdk.init()
called ignore_logged_errors
(that defaults to the value of ignore_errors
if not provided), which log records with exc_info
are filtered by..? 🤔
Alternatively/additionally, you could let users provide a function for ignore_errors
that gives more fine-grained control instead of just a list of exception classes - perhaps in the same vein as before_send
/before_send_transaction
.
In any case, it would be useful for the docs on ignore_errors
to mention that exception logs are also filtered by it :)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status