Skip to content

Sentry is not logging ERROR logs by default #1191

Closed

Description

@sliwinski-milosz

Hi!

I have realised lately that not all of the events from my service were reaching Sentry.

I noticed that the event didn't reach the Sentry server when I was testing some case for which I was expecting to see the alarm. The alarm was not triggered and the event was not in Sentry even when I was able to see the service error log.
I started to dig depper by enabling DEBUG logs.

It turned out that rarely, when Sentry was trying to send an event, it was failiing with "Connection reset by peer" error.
This was most like caused by following issue (just in case if someone bumped into the same problem):
Issue: urllib3/urllib3#944 (comment)
Workaround: psf/requests#4937 (comment)

The problem I see here is that I have been using Sentry for 3 years not realising that some events were not passed to the Sentry server.

Do you think it would make sense to actually enable Sentry ERROR logs by default so we are aware if the integration is not working as expected?

Activity

  1. sl0thentr0py commented on Jan 27, 2022

    @sl0thentr0py
    Member

    No I don't think we want to enable logs by default, having it as a config for debugging is fine.
    What we do have now are Client Reports which collect statistics about event drops due to several reasons and adds some transparency on what is happening inside the SDK. Exposing these stats on the user interface is also on the pipeline.

  2. sliwinski-milosz commented on Jan 27, 2022

    @sliwinski-milosz
    Author

    Then is there a way to set logging level from config? I'd like to enable only ERROR logs, not the DEBUG ones?

  3. sl0thentr0py commented on Jan 27, 2022

    @sl0thentr0py
    Member

    It's not exposed as config but you can just import the logger and do whatever you want with it.

    from sentry_sdk.utils import logger
    
    logger.removeFilter
    logger.removeHandler
    logger.setLevel
    
  4. sliwinski-milosz commented on Jan 28, 2022

    @sliwinski-milosz
    Author

    Thank you! I will use that approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions