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

Reduce the amount of debug logs #2752

Open
vaind opened this issue Feb 25, 2025 · 7 comments
Open

Reduce the amount of debug logs #2752

vaind opened this issue Feb 25, 2025 · 7 comments

Comments

@vaind
Copy link
Collaborator

vaind commented Feb 25, 2025

Problem Statement

When I am running my flutter app locally flutter run, the Sentry SDK emits logs as well since it is default debug: true. This consumes everything in my console and make it impossible to catch other framework, libary, build, run time console logs related to errors when trying to run my app.

Also when replay is present event setting debug: false, does nothing. This is it's own bug #2759

Solution Brainstorm

  1. There's a lot of logging happening in debug builds (with debug=true) for Replay. For example, the WidgetFilter logs a lot of info that was meant to be used during development but we don't actually need that most of the time. We should verify the logs are relevant and if not, remove them.

  2. Alternatively, we could bump the default log level for when options.debug is true from SentryLevel.debug to SentryLevel.info.

  1. Add debug levels, not just true/false. A verbose flag for example, or multiple levels the user can choose from, which when NOT set, the SDK will never log, entire event payloads for example, since that takes up a ton of space.

Backstory

SDKs can choose what the default log level is, develop docs:

The default level can be debug or error depending on the SDK's usage of log messages. When the volume of log message is low, the default can be debug. When it is high, users might easily miss errors or fatal messages. In that case, the SDK should set the default level to error. This choice must be clearly documented in the user-facing docs.

We recently changed this on some mobile SDKs because we have so many debug logs that you can easily miss critical errors. This came up at a customer call with [redacted]. We tried to fix a problem and missed a critical error log message that would have easily pointed them to fix it themselves. Now the Cocoa SDK, for example, logs always logs error even when having debug = false. Debug = true is extremely verbose and handy for diagnosing SDK issues.

@github-project-automation github-project-automation bot moved this to Needs Discussion in Mobile SDKs Feb 25, 2025
@kahest kahest moved this from Needs Discussion to Todo in Mobile SDKs Feb 25, 2025
@buenaflor
Copy link
Contributor

Alternatively, we could bump the default log level for when options.debug is true from SentryLevel.debug to SentryLevel.info.

related: getsentry/sentry-cocoa#4467, cocoa plans to set it to warning we could also adopt that here

@buenaflor
Copy link
Contributor

buenaflor commented Mar 10, 2025

Add debug levels, not just true/false. A verbose flag for example, or multiple levels the user can choose from

isn't that what the diagnosticLevel option is for? the user could change that e.g to SentryLevel.fatal

@vaind
Copy link
Collaborator Author

vaind commented Mar 10, 2025

Add debug levels, not just true/false. A verbose flag for example, or multiple levels the user can choose from

isn't that what the diagnosticLevel option is for? the user could change that e.g to SentryLevel.fatal

I agree.

I believe that part is @smeubank's edit so maybe he'd like to clarify.

@smeubank
Copy link
Member

I think the default experience should be less. Replay and android logs, both seem to be contributing too much in an erroneous way, whcih should be fixed, But overall the default debug experience of SDKs is way too verbose in my opinion. cc @cleptric for thought across SDKs, but using diagnosticLevel or --verbose type flags should only be in special scenarios where you need SOO much info. Rarely is logging the whole JSONs really useful for anyone for example. That should not be included in simply debug: true

@cleptric
Copy link
Member

The trend we've seen is actually quite the opposite. People manually instrument something, it does not work, our debug logs don't help. So I'm actually more inclined to be as verbose as possible. On certain platforms, merging your app's stdout with all the Sentry SDK logs can be a PITA though. I have no good solution besides offering a dedicated log stream.

@smeubank
Copy link
Member

smeubank commented Mar 17, 2025

The trend we've seen is actually quite the opposite. People manually instrument something, it does not work, our debug logs don't help.

  1. i think this is directed at those who do complain
  2. i would be curious to understand why they don't help, and fix that problem instead of just going with verbose AF. This isn't a fix, this is using the whole roll of duct tape and hoping for the best.

Because for me the debug logs on most SDKs i use don;t help. I want to understand what the SDK is doing on a high level at first. THEN get into verbose details only maybe later. I still stand by loggin JSON event bodies as being way too much 90% of the time.

@cleptric
Copy link
Member

cleptric commented Mar 17, 2025

I still stand by loggin JSON event bodies as being way too much 90% of the time.

Yes, this is overkill.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

4 participants