Skip to content

Option to add buffered (fingers_crossed) logs to context #286

@rbaarsma

Description

@rbaarsma

I want to use the awesome Symfony standard functionality "fingers_crossed" -- to only trigger on errors, but also log previous logs from the same requests as context -- with sentry.

Here's my attempt:

        main:
            type: fingers_crossed
            action_level: error
            handler: grouped

        grouped:
            type: group
            members: [streamed, sentry]

        streamed:
            type: stream
            path: "php://stdout"
            level: info

        sentry:
            type: service
            id: Sentry\Monolog\Handler
            level: info

This works, but unfortunately each info/warning that is now also logged, because of the fingers_crossed functionality, becomes a separate issue in sentry.

I know that with the (old) Raven client it was possible to group the logs, see https://stackoverflow.com/questions/51310575/monolog-send-errors-to-sentry-with-preserved-lower-level-log-records

It seems the new handler does not support working with a buffered stack.

Also, did you know the RavenHandler is still bundled by default with monolog, even though it's outdated? Perhaps you could create a PR to add a proper handler to monolog directly, then this whole bundle would become obsolete, because I think 99% using the symfony framework, is using monolog too and would be great if we can simply have a sentry handler.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions