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

Add the Monolog hook functionality

Open Jean85 opened this issue 3 years ago • 4 comments

This is another attempt at #337

I'm currently following the strategy outlined in https://github.com/getsentry/sentry-symfony/issues/337#issuecomment-800920045

It seems to work with this config:

sentry:
  register_error_listener: false
  monolog:
    error_handler:
      enabled: true
  options:
    # TODO: add a simple option to switch off the error/fatal integrations
    default_integrations: false
    integrations: []

But E2E tests are failing and I'm having a hard time to run them with the debugger.

Jean85 avatar Nov 19 '21 21:11 Jean85

Reason found: attacching the handler to monolog.logger is not enough, that's just the logger for the default channel (normally app).

We would need to add the handler to all the existing channels, but I can't find an easy way to do it, the services are not tagged, they are just called monolog.logger.{channel_name}.

Jean85 avatar Nov 19 '21 23:11 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]

@nicolas-grekas, since you were the first in suggesting this approach of attaching Sentry to Monolog in #337, do you have any suggestion to solve this issue? :point_down: Or can you point me to someone else that could help?

Reason found: attacching the handler to monolog.logger is not enough, that's just the logger for the default channel (normally app).

We would need to add the handler to all the existing channels, but I can't find an easy way to do it, the services are not tagged, they are just called monolog.logger.{channel_name}.

Jean85 avatar Jun 01 '22 16:06 Jean85

hey @Jean85 ,

thanks for this pr / explanation :) from what i understand, at this time if we want to work with monolog and sentry (as simple handler of monolog) , the best solution (for prod env) is to use alt https://github.com/B-Galati/monolog-sentry-handler/ ? (the time to this pr to be finished :crossed_fingers: )

cbastienbaron avatar Jan 15 '24 08:01 cbastienbaron