sentry-php
sentry-php copied to clipboard
Option to capture only exceptions in Monolog handler
Problem Statement
Currently, the Monolog\Handler handler sends both the message and the exception events to Sentry, if the exception key is present in the log context.
It would be very useful to have an option in Monolog\Handler to capture only exceptions and skip capturing plain messages, since those should be handled by other handlers (eg. LogsHandler).
Solution Brainstorm
Add a new option, e.g. $captureOnlyExceptions (default: false for backwards compatibility).
- When
false: keep current behavior (capture both message and exception). - When
true: capture only the exception (if present in context).
Hi @mnow-cd! Thanks for opening the issue. I will take a closer look and come back to you