Skip to content

When using Monolog\Handler informations added by sentry listeners are missing #250

@JanMikes

Description

@JanMikes

Hi, there is something very weird going on.

Here is my config

services:
    Sentry\Monolog\Handler:
        arguments:
            $hub: '@Sentry\State\HubInterface'
            $level: 'error'

monolog:
    handlers:
        sentry:
            type: service
            id: Sentry\Monolog\Handler
            level: notice

But when i log, etc $this->logger->critical(), event in sentry does not contain extra informations added by Sentry\SentryBundle\EventListener\RequestListener.

By debugging i found out there are 2 different instances of HubInterface. 1 lives in our DI container and second on is in static SentrySdk::$currentHub property.

What RequestListener does, is only saving this to the static hub, meanwhile in monolog handler, the instance from DI is wired:
Screenshot 2019-09-28 21 05 07

On a screenshot you can see these are 2 different instances of hubs, one contains client (created and autowired by DI) the other does not.

I am thinking, if there is not missing SentrySdk::setCurrentHub() with the hub created by DI?

Maybe i am just missing something, but this causes many confusions for me.

This might be related to #247

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions