Skip to content

Send logcat through Sentry Logs #4487

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

stefanosiano
Copy link
Member

📜 Description

SentryLogcatAdapter now forwards output to Sentry Logs, if enabled

💡 Motivation and Context

Closes #4408

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

github-actions bot commented Jun 12, 2025

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 77c5c53

Copy link
Contributor

github-actions bot commented Jun 12, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 397.86 ms 416.63 ms 18.77 ms
Size 1.58 MiB 2.09 MiB 518.67 KiB

Previous results on branch: feat/logcat-sentry-logs

Startup times

Revision Plain With Sentry Diff
d035656 399.04 ms 416.73 ms 17.69 ms
771a432 410.52 ms 458.84 ms 48.32 ms
2e00745 440.67 ms 489.81 ms 49.14 ms

App size

Revision Plain With Sentry Diff
d035656 1.58 MiB 2.08 MiB 511.32 KiB
771a432 1.58 MiB 2.08 MiB 511.32 KiB
2e00745 1.58 MiB 2.09 MiB 518.68 KiB

@stefanosiano stefanosiano marked this pull request as ready for review June 13, 2025 09:28
return Log.e(tag, msg, tr);
}

public static int wtf(@Nullable String tag, @Nullable String msg) {
addAsBreadcrumb(tag, SentryLevel.ERROR, msg);
addAsLog(SentryLogLevel.FATAL, msg, null);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not too sure about the log level here.
should we use error instead of fatal?

@ishanzuaim
Copy link

Hi, this is a feature I am quite keen on, so just dropping some useful (easy to add?) additions

  • Automatically include the log tag as an attribute of the log event
  • Introduce a config option where the minimum log level can be set

@stefanosiano
Copy link
Member Author

hi @ishanzuaim, and thanks for the interest!

You can already set the minimum logging level in the gradle plugin options following the logcat integration documentation

sentry {
  tracingInstrumentation {
    ...
    logcat {
      enabled = true
      minLevel = LogcatLevel.WARNING
    }
  }
}

We'll discuss how to best send the tag in the logs, too!

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

Successfully merging this pull request may close these issues.

Integration for Sentry Logs through Logcat
5 participants