Skip to content

fix: demote spurious ANR log from warn to info#2660

Merged
nan-li merged 1 commit into
mainfrom
chore/demote_anr_warn_to_info
Jun 10, 2026
Merged

fix: demote spurious ANR log from warn to info#2660
nan-li merged 1 commit into
mainfrom
chore/demote_anr_warn_to_info

Conversation

@nan-li

@nan-li nan-li commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

One Line Summary

Demote a log from warn to info, and we send the exception log anyway down the line.

Details

If we set apps to WARN level, we get a lot of spurious "⚠️ ANR detected" warning logs that overwhelm the real warning-level logs. This also logs when the ANR is not due to OneSignal, so it is extraneous.

If the ANR is due to the SDK, we do send the exception to our logging service anyway:

val anrException = ApplicationNotRespondingException(
    "Application Not Responding: Main thread blocked for ${unresponsiveDurationMs}ms",
    stackTrace
)

Motivation

Logs are overwhelmed by this spurious warning.

Scope

logging only

Testing

Unit testing

None

Manual testing

Seeing a lot of these logs in logcat

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

At warn-level, this creates too much volume so that real warning level logs are overwhelmed by this. This also includes ANRs that are not because of onesignal, and eventually those get reported anyway, so we don't need another spurious warning log.
@nan-li nan-li requested a review from a team June 9, 2026 17:34
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

📊 Diff Coverage Report

Diff Coverage Report (Changed Lines Only)

Gate: aggregate coverage on changed executable lines must be ≥ 80% (JaCoCo line data for lines touched in the diff).

Changed Files Coverage

  • OtelAnrDetector.kt: 0/1 touched executable lines (0.0%) (1 touched lines in diff)
    • 1 uncovered touched lines in this file

Overall (aggregate gate)

0/1 touched executable lines covered (0.0% — requires ≥ 80%)

Per-file detail (informational; gate is aggregate above):

  • OtelAnrDetector.kt: 0.0% (1 uncovered touched lines)

❌ Coverage Check Failed

Aggregate coverage on touched lines is 0.0% (minimum 80%).

📥 View workflow run

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.

2 participants