Skip to content

chore: Logging lower severity#2531

Merged
jkasten2 merged 1 commit intoar-otel-crash-reportingfrom
logging-lower-severity
Jan 29, 2026
Merged

chore: Logging lower severity#2531
jkasten2 merged 1 commit intoar-otel-crash-reportingfrom
logging-lower-severity

Conversation

@jkasten2
Copy link
Copy Markdown
Member

@jkasten2 jkasten2 commented Jan 27, 2026

Description

One Line Summary

Better classify errors, warning, ect we send to OneSignal, which will lower volume as well.

Details

Motivation

The main motivation is to better classify errors, warning, ect we send in the otel format to OneSignal, which will lower volume as well.

Considerations

There is only one severity per log entry, however the severity is different between the app developer and OneSignal.
Example, the app developer may have something configured wrong in their project preventing the SDK from registering for push, this would be an error in the context of the app developer, but OneSignal would consider this info instead. An error in the context of the app developer since this means a major feature is not working for their app, but only an info level since the SDK is not at fault.

Scope

Only effects logging

Manual testing

Tested on an Android 14 emulator

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.

This change is Reviewable

Severity lower to match what is sever to OneSignal, not necessary the
app developer.
The main motivation is to better classify errors, warning, ect we send
in the otel format to OneSignal, which will lower volume as well.
Copy link
Copy Markdown
Contributor

@abdulraqeeb33 abdulraqeeb33 left a comment

Choose a reason for hiding this comment

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

just couple of questions but looks fine to me

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reclassifies logging severity levels across the OneSignal Android SDK to reduce log volume sent to OneSignal in OTEL format. The changes focus on downgrading logs from error/fatal to more appropriate levels (warn/info/debug) for non-critical issues.

Changes:

  • Downgrade configuration/setup errors (missing libraries, invalid settings) from fatal/error to warn/info
  • Downgrade successful registration messages from error to debug
  • Downgrade timeout and retry failures from error to info/warn
  • Improve error logging by properly passing exception objects instead of using printStackTrace()

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
ADMMessageHandlerJob.kt Registration errors downgraded from error to info
ADMMessageHandler.kt Registration errors downgraded from error to info
NotificationRestoreProcessor.kt Restoration errors downgraded from error to warn
PushRegistratorHMS.kt Success log downgraded to debug, timeout to warn
PushRegistratorAbstractGoogle.kt Configuration/library errors downgraded to warn, retry failures to info
PushRegistratorADM.kt Success log downgraded to debug, timeout to info
ReceiveReceiptProcessor.kt Backend failures downgraded from error to info
PushTokenManager.kt Missing/outdated Jetpack library downgraded from fatal to info
NotificationLifecycleService.kt Various downgrades: debug for intents, warn for ActivityNotFoundException, improved error logging with exception parameters
NotificationGenerationProcessor.kt Callback timeouts and exceptions downgraded from error to info
NotificationRepository.kt Cleanup errors downgraded from error to warn
OSWorkManagerHelper.kt WorkManager initialization errors downgraded from error to warn
NotificationChannelManager.kt Channel-related errors downgraded from error to warn
OneSignalHmsEventBridge.kt JSON errors downgraded from error to warn
HmsLocationController.kt Location service errors downgraded from error to warn
LocationManager.kt Permission errors downgraded from error to info
InAppHydrator.kt Missing HTML content log changed from debug to info
InAppMessageView.kt Missing presenter log downgraded from error to info
InAppDisplayer.kt WebView errors downgraded from error to info
InAppBackendService.kt Backend request errors downgraded from error to info
LoginHelper.kt Login failures downgraded from error to warn
SessionListener.kt Invalid duration errors downgraded from error to info
OutcomeEventsController.kt Outcome event failures downgraded: retryable to info, non-retryable to warn
OperationRepo.kt Operation failures downgraded to warn/info, retry delay to debug
HttpClient.kt Request timeouts downgraded from error to info
BackgroundManager.kt Job scheduling errors downgraded from error to info
JSONUtils.kt Nested value warnings downgraded from error to warn

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +158 to +160
Logging.info("Notification opened confirmation failed with statusCode: ${ex.statusCode} response: ${ex.response}")
} else {
Logging.error("Unexpected error in notification opened confirmation", ex)
Logging.info("Unexpected error in notification opened confirmation", ex)
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Downgrading notification opened confirmation failures from Logging.error to Logging.info may be too severe. While this is a non-critical backend operation that can fail, it represents a loss of analytics data that developers may want to be alerted about. Consider using Logging.warn instead to maintain better visibility while still reducing log volume.

Copilot uses AI. Check for mistakes.
_backend.updateNotificationAsReceived(appId, notificationId, subscriptionId, deviceType)
} catch (ex: BackendException) {
Logging.error("Receive receipt failed with statusCode: ${ex.statusCode} response: ${ex.response}")
Logging.info("Receive receipt failed with statusCode: ${ex.statusCode} response: ${ex.response}")
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Downgrading receive receipt backend failures from Logging.error to Logging.info may hide important analytics issues. While receipt confirmation is non-critical for app functionality, consistent failures could indicate backend or configuration problems. Consider using Logging.warn instead to maintain visibility of these issues while reducing log volume.

Suggested change
Logging.info("Receive receipt failed with statusCode: ${ex.statusCode} response: ${ex.response}")
Logging.warn("Receive receipt failed with statusCode: ${ex.statusCode} response: ${ex.response}")

Copilot uses AI. Check for mistakes.
Logging.info("notificationWillShowInForegroundHandler timed out, continuing with wantsToDisplay=$wantsToDisplay.", to)
} catch (t: Throwable) {
Logging.error(
Logging.info(
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Downgrading callback exception handling from Logging.error to Logging.info is questionable. When a developer's callback throws an exception (remoteNotificationReceived or notificationWillShowInForegroundHandler), this represents a bug in the developer's code that they should be notified about. Consider keeping this at Logging.error or using Logging.warn to ensure developers are aware of issues in their notification handling code.

Suggested change
Logging.info(
Logging.warn(

Copilot uses AI. Check for mistakes.
val content = InAppMessageContent(jsonObject)
if (content.contentHtml == null) {
Logging.debug("displayMessage:OnSuccess: No HTML retrieved from loadMessageContent")
Logging.info("displayMessage:OnSuccess: No HTML retrieved from loadMessageContent")
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Changing this log from Logging.debug to Logging.info may be unnecessary. This appears to be a normal case where HTML content is not available (not an error condition), and debug level seems more appropriate for such operational details. Consider reverting to debug to avoid cluttering info logs with normal flow conditions.

Suggested change
Logging.info("displayMessage:OnSuccess: No HTML retrieved from loadMessageContent")
Logging.debug("displayMessage:OnSuccess: No HTML retrieved from loadMessageContent")

Copilot uses AI. Check for mistakes.
when (_deviceService.jetpackLibraryStatus) {
IDeviceService.JetpackLibraryStatus.MISSING -> {
Logging.fatal("Could not find the Jetpack/AndroidX. Please make sure it has been correctly added to your project.")
Logging.info("Could not find the Jetpack/AndroidX. Please make sure it has been correctly added to your project.")
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Downgrading from Logging.fatal to Logging.info for missing Jetpack/AndroidX library may be too severe a reduction. This is a critical configuration issue that prevents push notifications from working entirely. Consider using Logging.warn instead to maintain visibility of this important configuration problem while still reducing log volume.

Suggested change
Logging.info("Could not find the Jetpack/AndroidX. Please make sure it has been correctly added to your project.")
Logging.warn("Could not find the Jetpack/AndroidX. Please make sure it has been correctly added to your project.")

Copilot uses AI. Check for mistakes.
}
IDeviceService.JetpackLibraryStatus.OUTDATED -> {
Logging.fatal(
Logging.info(
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Downgrading from Logging.fatal to Logging.info for outdated Jetpack/AndroidX library may be too severe a reduction. This is a critical configuration issue that prevents push notifications from working entirely. Consider using Logging.warn instead to maintain visibility of this important configuration problem while still reducing log volume.

Suggested change
Logging.info(
Logging.warn(

Copilot uses AI. Check for mistakes.
@jkasten2 jkasten2 merged commit 6ebd305 into ar-otel-crash-reporting Jan 29, 2026
9 of 10 checks passed
@jkasten2 jkasten2 deleted the logging-lower-severity branch January 29, 2026 16:34
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.

3 participants