sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

Add breadcrumb monolog handler

Open Jean85 opened this issue 3 years ago • 5 comments

This is an interesting additional feature, that would be a required stepping stone for me to proceed with the strategy outlined in https://github.com/getsentry/sentry-symfony/issues/337#issuecomment-800920045.

Jean85 avatar Mar 17 '21 10:03 Jean85

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Jan 12 '22 21:01 github-actions[bot]

This should wait for #1275

Jean85 avatar Jan 12 '22 22:01 Jean85

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Feb 04 '22 09:02 github-actions[bot]

Do you have plan to release this change?

miedzikd avatar May 30 '22 06:05 miedzikd

It needs more work after #1321, I'll try to look at it now.

Jean85 avatar May 30 '22 06:05 Jean85

@Jean85 is there any way we can help on this PR , as this would remove for us the need of https://github.com/B-Galati/monolog-sentry-handler (as we use it to get log as breadcrumb )

allan-simon avatar Aug 23 '22 16:08 allan-simon

This needs a rebase/remerge badly. I'll try it now.

Jean85 avatar Aug 24 '22 07:08 Jean85

@Jean85 Just some general thoughts/questions

  • From what I gathered from the linked issue, this will primarily be used in the Symfony SDK. Would it suffice to add it only there?
  • Do we need to add some docs to tell people how to wire it up on their application if they use monolog?

cleptric avatar Aug 29 '22 12:08 cleptric

  • the Symfony official integration would be the main immediate beneficiary of this feature, but since it's based on Monolog, it can be used/leveraged everywhere
  • this may depend a lot on the application, since Monolog could be wired manually or baked into the app config (see Symfony, maybe Laravel too?)

I would ask @stayallive if the Laravel integration could benefit from this too, and/or if it could require dedicated documentation.

Jean85 avatar Aug 29 '22 12:08 Jean85

This could possibly also be used by Laravel, since Laravel also uses Monolog under the hood, so it would probably need some added info to the documentation on how to leverage this in a Laravel context.

stayallive avatar Aug 29 '22 13:08 stayallive

Any updates about the doc to know how to set it up?

B-Galati avatar Sep 06 '22 07:09 B-Galati

I'll write something up in the coming days 🙂 https://github.com/getsentry/sentry-docs/issues/5487

cleptric avatar Sep 06 '22 10:09 cleptric

I'll write something up in the coming days slightly_smiling_face getsentry/sentry-docs#5487

Any update on this?

michaelgracious avatar Oct 11 '22 12:10 michaelgracious

In short, do this:

services:
    Sentry\Monolog\BreadcrumbHandler:
        arguments:
            - '@Sentry\State\HubInterface'
            - !php/const Monolog\Logger::INFO

monolog:
    handlers:
        # this one acts like fingers_crossed
        sentry_breadcrumbs:
            type: service
            name: sentry_breadcrumbs
            id: Sentry\Monolog\BreadcrumbHandler
        # this one is the main one, once it captures, the breadcrumbs collected by the first one are submitted too
        sentry:
            type: sentry
            level: !php/const Monolog\Logger::ERROR
            hub_id: Sentry\State\HubInterface

dkarlovi avatar Nov 09 '22 15:11 dkarlovi