It looks like we're using the wrong scope on Android to capture logs.
Here are some logs before an ANR was capture: https://sentry-sdks.sentry.io/explore/logs/?end=2025-08-20T15%3A30%3A43&logsFields=timestamp&logsFields=message&logsSortBys=-timestamp&project=5428559&start=2025-08-20T11%3A00%3A43&utc=true
And here's the ANR event being sent on the next app start:
https://sentry-sdks.sentry.io/issues/6811829844/events/df2116c9c3b940aab283fab7e7930547/?project=5428559&query=is%3Aunresolved%20issue.category%3A%5Berror%2Coutage%5D&referrer=next-event
Debugging reveals the the trace id being persisted doesn't match the trace id being used to capture the log item:
|
final @Nullable SentryDate timestamp = params.getTimestamp(); |
|
final @NotNull SentryDate timestampToUse = |
|
timestamp == null ? options.getDateProvider().now() : timestamp; |
|
final @NotNull String messageToUse = maybeFormatMessage(message, args); |
|
|
|
final @NotNull IScope combinedScope = scopes.getCombinedScopeView(); |
|
final @NotNull PropagationContext propagationContext = combinedScope.getPropagationContext(); |
|
final @Nullable ISpan span = combinedScope.getSpan(); |
|
if (span == null) { |
|
TracingUtils.maybeUpdateBaggage(combinedScope, options); |
|
} |
|
final @NotNull SentryId traceId = |
|
span == null ? propagationContext.getTraceId() : span.getSpanContext().getTraceId(); |
|
final @NotNull SpanId spanId = |
|
span == null ? propagationContext.getSpanId() : span.getSpanContext().getSpanId(); |
|
final SentryLogEvent logEvent = |
|
new SentryLogEvent(traceId, timestampToUse, messageToUse, level); |
|
logEvent.setAttributes(createAttributes(params.getAttributes(), message, spanId, args)); |
|
logEvent.setSeverityNumber(level.getSeverityNumber()); |
|
|
|
scopes.getClient().captureLog(logEvent, combinedScope); |
, so this is probably an issue around using the wrong scope.
It looks like we're using the wrong scope on Android to capture logs.
Here are some logs before an ANR was capture: https://sentry-sdks.sentry.io/explore/logs/?end=2025-08-20T15%3A30%3A43&logsFields=timestamp&logsFields=message&logsSortBys=-timestamp&project=5428559&start=2025-08-20T11%3A00%3A43&utc=true
And here's the ANR event being sent on the next app start:
https://sentry-sdks.sentry.io/issues/6811829844/events/df2116c9c3b940aab283fab7e7930547/?project=5428559&query=is%3Aunresolved%20issue.category%3A%5Berror%2Coutage%5D&referrer=next-event
Debugging reveals the the trace id being persisted doesn't match the trace id being used to capture the log item:
sentry-java/sentry/src/main/java/io/sentry/logger/LoggerApi.java
Lines 119 to 139 in b93e18d