Skip to content

Option to capture only exceptions in Monolog handler #1919

@mnow-cd

Description

@mnow-cd

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).

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions