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

Send logcat through Sentry Logs

Open stefanosiano opened this issue 8 months ago • 2 comments

:scroll: Description

SentryLogcatAdapter now forwards output to Sentry Logs, if enabled

:bulb: Motivation and Context

Closes https://github.com/getsentry/sentry-java/issues/4408

:green_heart: How did you test it?

:pencil: 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.

:crystal_ball: Next steps

stefanosiano avatar Jun 12 '25 14:06 stefanosiano

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

Generated by :no_entry_sign: dangerJS against 4a90aba315110c054518ead1ad6934154b3762d7

github-actions[bot] avatar Jun 12 '25 14:06 github-actions[bot]

Performance metrics :rocket:

  Plain With Sentry Diff
Startup time 336.43 ms 377.71 ms 41.29 ms
Size 1.58 MiB 2.09 MiB 518.94 KiB

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

Startup times

Revision Plain With Sentry Diff
2e00745d86fdd2f2bf5595a20266b4e56bc23122 440.67 ms 489.81 ms 49.14 ms
296205e847eb50eb898f435c87f527dc2e3adc58 397.86 ms 416.63 ms 18.77 ms
229d93757e27987cea34e39b8d1ab29ecc8261d1 407.06 ms 448.72 ms 41.66 ms
d035656eb9c3dea4956086d905f18b365b1c038f 399.04 ms 416.73 ms 17.69 ms
771a432569118928b212cbcfcaa80628a862862b 410.52 ms 458.84 ms 48.32 ms

App size

Revision Plain With Sentry Diff
2e00745d86fdd2f2bf5595a20266b4e56bc23122 1.58 MiB 2.09 MiB 518.68 KiB
296205e847eb50eb898f435c87f527dc2e3adc58 1.58 MiB 2.09 MiB 518.67 KiB
229d93757e27987cea34e39b8d1ab29ecc8261d1 1.58 MiB 2.09 MiB 518.93 KiB
d035656eb9c3dea4956086d905f18b365b1c038f 1.58 MiB 2.08 MiB 511.32 KiB
771a432569118928b212cbcfcaa80628a862862b 1.58 MiB 2.08 MiB 511.32 KiB

github-actions[bot] avatar Jun 12 '25 15:06 github-actions[bot]

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

ishanzuaim avatar Jun 20 '25 05:06 ishanzuaim

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!

stefanosiano avatar Jun 20 '25 09:06 stefanosiano