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.
Requirements
- A device able to reproduce the issue
- Access to the mobile app's dev tools.
Step 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
.
//The following options are available with increasingly more information:
//NONE, FATAL, ERROR, WARN, INFO, DEBUG, VERBOSE
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
//The following options are available with increasingly more information:
//.LL_NONE, .LL_FATAL, .LL_ERROR, .LL_WARN, .LL_INFO, .LL_DEBUG, .LL_VERBOSE.
OneSignal.setLogLevel(.LL_VERBOSE, visualLevel: .LL_NONE)
////The following options are available with increasingly more information:
//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 setLogLevel:ONE_S_LL_VERBOSE visualLevel:ONE_S_LL_NONE];
//The following options are available with increasingly more information:
//None, Fatal, Error, Warn, Info, Debug, Verbose
OneSignal.Default.LogLevel = LogLevel.Info;
OneSignal.Default.AlertLevel = LogLevel.Error;
//The following options are available with increasingly more information:
//0 = NONE, 1 = FATAL, 2 = ERROR, 3 = WARN, 4 = INFO, 5 = DEBUG, 6 = VERBOSE
OneSignal.setLogLevel(6, 0);
//The following options are available with increasingly more information:
//none, fatal, error, warn, info, debug, verbose
OneSignal.shared.setLogLevel(OSLogLevel.verbose, OSLogLevel.none);
//The following options are available with increasingly more information:
//0 = NONE, 1 = FATAL, 2 = ERROR, 3 = WARN, 4 = INFO, 5 = DEBUG, 6 = VERBOSE
// Ionic 5 Capacitor may need to use (window as any).plugins.OneSignal
window.plugins.OneSignal.setLogLevel({logLevel: 6, visualLevel: 0});
//The following options are available with increasingly more information:
//NONE, FATAL, ERROR, WARN, INFO, DEBUG, VERBOSE
// Needs: using Com.OneSignal.Abstractions;
OneSignal.Current.SetLogLevel(LOG_LEVEL.VERBOSE, LOG_LEVEL.NONE);
-- The following options are available with increasingly more information:
--0 = NONE, 1 = FATAL, 2 = ERROR, 3 = WARN, 4 = INFO, 5 = DEBUG, 6 = VERBOSE
OneSignal.SetLogLevel(6, 0)
Step 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.
Step 3. 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
- Select Run from the bottom of the window.
------If you don't see this select it from View > Tool Windows > Run
- Run your application on your emulator or device
- Select all lines in the log that appear within your Run console by pressing Control + A and then copy them.
- 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.
- In Xcode go to
Window
>Devices & Simulators
. - Select your device on the left and press the "Open Console" button.
- Select "All Messages" (top left)
- Reproduce issue with the connected device.
- Press
Command + A
to select all, thenCommand + C
to copy log - Send it to OneSignal support along with details on reproducing the crash.
Updated over 1 year ago