sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Capture logcat output as attachment

Open bruno-garcia opened this issue 2 years ago • 3 comments

Problem Statement

Through this issue, we started capturing logcat logs as breadcrumb:

  • https://github.com/getsentry/sentry-java/issues/1620

We used the gradle plugin and bytecode manipulation to capture the logcat API done by libraries in the app itself. But that means we're not capturing system logs, for example.

@romtsn said:

this works for the app and libraries logcat calls, but not the system ones. Also it supports all Android versions, while this approach is from API 23 and above.

We received a PR in the .NET SDK

  • https://github.com/getsentry/sentry-dotnet/pull/2926

That adds logcat logs as attachments (opt-in) with mime type text/logcat. And a ticket was created to have a custom preview in Sentry:

  • https://github.com/getsentry/sentry/issues/61005

Ideally this is available for all cross platform SDKs like React Native and Flutter. If it can't be made available through the native bridget, we can duplicate this ticket in the other repos.

bruno-garcia avatar Dec 01 '23 23:12 bruno-garcia

As the logcat output may contains PII data we need to be careful here. Other considerations:

  • make the feature opt-in
  • filter output by running app / process id + system apps

markushi avatar Dec 13 '23 15:12 markushi

@bruno-garcia up for a PR? 😉

markushi avatar Dec 13 '23 15:12 markushi

I wish, don't really find the time to contribute much. Wanted to get this one in and didn't manage to yet: https://github.com/getsentry/sentry-dotnet/pull/2709/

bruno-garcia avatar Jan 02 '24 18:01 bruno-garcia