Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry is not logging ERROR logs by default #1191

Closed
sliwinski-milosz opened this issue Sep 13, 2021 · 4 comments
Closed

Sentry is not logging ERROR logs by default #1191

sliwinski-milosz opened this issue Sep 13, 2021 · 4 comments

Comments

@sliwinski-milosz
Copy link

sliwinski-milosz commented Sep 13, 2021

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?

@sl0thentr0py
Copy link
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.

@sliwinski-milosz
Copy link
Author

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

@sl0thentr0py
Copy link
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

@sliwinski-milosz
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants