Capturing a Debug Log

How to check what OneSignal is doing in your app.

When something isn't working as expected, the best way to see what’s occurring under the hood without sharing the source code, is to capture a debug log. With this log, you can further analyze your app or share it with our Support Team for further assistance.

📘

You're Viewing User Model Documentation 🎉

OneSignal is in the process of migrating from a device-centric model (player ID) to a new user-centric data model (OneSignal ID). To learn more, check out the User Model Migration Guide.

Please refer to Version 9 of our documentation for device-centric information.

Requirements

  • A device able to reproduce the issue
  • Access to the mobile app's dev tools
  • OneSignal Mobile SDK 5.0.0+ (If using an earlier SDK version see Version 9.0 docs)

Get the Logs

1. Add Verbose Logging To Your App

OneSignal.setLogLevel allows you to get extra logging related to OneSignal's API requests. Call this method with the verbose option before OneSignal.init.

Set the logging level to print logs Android LogCat or Xcode logs.

// LogLevel: NONE | FATAL | ERROR | WARN | INFO | DEBUG | VERBOSE
OneSignal.getDebug().setLogLevel(OneSignal.LOG_LEVEL.VERBOSE);

// LogLevel: .None | .Fatal | .Error | .Warn | .Info | .Debug | .Verbose
OneSignal.Debug.logLevel = LogLevel.Verbose

// LogLevel: ONE_S_LL_NONE | ONE_S_LL_FATAL | ONE_S_LL_ERROR | ONE_S_LL_WARN | ONE_S_LL_INFO | ONE_S_LL_DEBUG | ONE_S_LL_VERBOSE
[OneSignal.Debug setLogLevel:ONE_S_LL_VERBOSE];

// LogLevel: ONE_S_LL_NONE | ONE_S_LL_FATAL | ONE_S_LL_ERROR | ONE_S_LL_WARN | ONE_S_LL_INFO | ONE_S_LL_DEBUG | ONE_S_LL_VERBOSE
OneSignal.Debug.setLogLevel(.LL_VERBOSE)

// LogLevel: None | Fatal | Error | Warn | Info | Debug | Verbose
OneSignal.Debug.LogLevel = LogLevel.Verbose;

OneSignal.Debug.setLogLevel(6);

OneSignal.Debug.setLogLevel(OSLogLevel.error);

// 0 = None, 1 = Fatal, 2 = Errors, 3 = Warnings, 4 = Info, 5 = Debug, 6 = Verbose
window.plugins.OneSignal.Debug.setLogLevel(6);

2. Reproduce the Issue

Plug the device into your dev tools and reproduce the issue while capturing the log. This will help trace any events and will likely help uncover any errors that might be happening.

Share

If the log didn't help solve the issue and you need further assistance, please share the entire log from app start to end of reproduction as a .txt file.

Android Studio

  1. Select Run from the bottom of the window.
    ------If you don't see this select it from View > Tool Windows > Run

  1. Run your application on your emulator or device
  2. Select all lines in the log that appear within your Run console by pressing Control + A and then copy them.
  3. Paste them into a .txt file and send this to support.

Here's a sample log for reference:
https://drive.google.com/file/d/1XphR4u4CRtUO37X6VZzzeyLUhq5pRMYw/view?usp=sharing

Xcode

NOTE: For your crash to show in the following steps the crash must happen when your device is not connected to your Mac. Connect it after you reproduce the crash.

  1. In Xcode go to Window > Devices & Simulators.
  2. Select your device on the left and press the "Open Console" button.
  3. Select "All Messages" (top left)
  4. Reproduce issue with the connected device.
  5. Press Command + A to select all, then Command + C to copy log
  6. Send it to OneSignal support along with details on reproducing the crash.