Debugging
View and understand Purchases logs
This section assumes you've followed our Quickstart section of our Getting Started guide to install and configure our SDK.
Debugging
RevenueCat's SDK will log important information and errors to help you understand what is going on behind the scenes. You can enable more detailed debug logs with the debugLogsEnabled
flag. You can set this immediately in your app while testing, before you configure Purchases.
Purchases.logLevel = .debug
Purchases.configure(withAPIKey: <public_sdk_key>, appUserID: <my_app_user_id>)
RCPurchases.logLevel = RCLogLevelDebug;
[RCPurchases configureWithAPIKey:@<public_sdk_key> appUserID:@<my_app_user_id>];
Purchases.debugLogsEnabled = true
Purchases.configure(PurchasesConfiguration.Builder(context, apiKey = "")
.appUserID(<my_app_user_id>)
.build()
Purchases.setDebugLogsEnabled(true);
Purchases.configure(new PurchasesConfiguration.Builder(context, <api_key>).appUserID(<my_app_user_id>).build());
Purchases.setDebugLogsEnabled(true);
Purchases.setup(<public_sdk_key>, <my_app_user_id>);
await Purchases.setDebugLogsEnabled(true);
PurchasesConfiguration pc = PurchasesConfiguration(<public_sdk_key>);
await Purchases.configure(pc);
Purchases.SetDebugLogsEnabled(true);
Purchases.setLogLevel(LOG_LEVEL.DEBUG);
OS_ACTIVITY_MODE and Common iOS Issues
On iOS, disabling
OS_ACTIVITY_MODE
in your Xcode scheme will block debug logs from printing in the console. If you have debug logs enabled, but don't see any output, go toProduct -> Scheme -> Edit Scheme...
in Xcode and uncheck theOS_ACTIVITY_MODE
environment variable.Flutter projects using Swift may fail to show debug logs in the console if you are using Visual Studio Code, Android Studio, or other IDE's to run your project. We recommend running your Flutter project using Xcode to view debug logs from the Purchases SDK.
Filtering Purchases Logs
All logs from the SDK are prepended with "[Purchases]
", you can use this string as a filter in your log output to clearly see the logs that are from Purchases.
Debug Logs Legend
Emojis currently available on the following platforms:
- Android version >= 4.0.2
- iOS version >= 3.10.1
Icon(s) | Log Level | Description | Required Actions |
---|---|---|---|
🍎 ‼️ | Error Warn | Error/warning messages generated from Apple | View error handling doc if on Error level |
🤖 ‼️ | Error Warn | Error/warning messages generated from Google | View error handling doc if on Error level |
📦 ‼️ | Error Warn | Error/warning messages generated from Amazon | View error handling doc if on Error level |
😿 ‼️ | Error | Error messages generated from RevenueCat | View error handling doc |
😻 | Debug | Success messages generated from RevenueCat | No action required, for informational purposes. |
😻💰 | Info | RevenueCat received purchase information | No action required, for informational purposes. |
💰 | Debug | Messages related to your products | No action required, for informational purposes. |
ℹ️ | Debug Info | Messages detailing events that occur in your app cycle | No action required, for informational purposes. |
👤 | Debug | Messages related to a user's App User ID | No action required, for informational purposes. |
⚠️ | Warn | Warning messages about implementation | View log message for additional information. |
Messages that have the double red exclamation marks prefix (‼️) attached provides important information regarding your implementation and may require your attention. Paying attention to the source of the message will assist you during the development process. Be sure to address these logs before shipping your app.
Sample Output
Below are sample logs generated when setting debugLogsEnabled = true
. Keep an eye out for any ERROR
level logs, status codes other than 200
, or any Invalid Product Identifiers
.
[Purchases] - DEBUG: Debug logging enabled.
[Purchases] - DEBUG: SDK Version - 2.0.0
[Purchases] - DEBUG: Initial App User ID - <APP_USER_ID>
[Purchases] - DEBUG: Changing App User ID: (null) -> <APP_USER_ID>
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>/products
[Purchases] - DEBUG: Delegate set
[Purchases] - DEBUG: Sending latest purchaser info to delegate
[Purchases] - DEBUG: Vending purchaserInfo from cache
[Purchases] - DEBUG: Vending purchaserInfo from cache
[Purchases] - DEBUG: applicationDidBecomeActive
[Purchases] - DEBUG: No cached entitlements, fetching
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID> 200
[Purchases] - DEBUG: Purchaser info updated, sending to delegate
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID>/products 200
[Purchases] - DEBUG: Requesting products with identifiers: {(
onetime,
annual,
onemonth
)}
[Purchases] - DEBUG: Products request finished
[Purchases] - DEBUG: Valid Products:
[Purchases] - DEBUG: annual - <SKProduct: 0x600000308980>
[Purchases] - DEBUG: onemonth - <SKProduct: 0x6000003131b0>
[Purchases] - DEBUG: onetime - <SKProduct: 0x600000313180>
[Purchases] - DEBUG: Invalid Product Identifiers - (
)
[Purchases] - DEBUG: 2 completion handlers waiting on products
[Purchases] - DEBUG: makePurchase - onemonth
[Purchases] - DEBUG: PaymentQueue updatedTransaction: onemonth (null) ((null)) - 0
[Purchases] - DEBUG: PaymentQueue updatedTransaction: onemonth <TRANSACTION_ID> ((null)) - 2
[Purchases] - DEBUG: Finishing onemonth <TRANSACTION_ID> ((null))
[Purchases] - DEBUG: PaymentQueue removedTransaction: onemonth <TRANSACTION_ID> ((null)) - 2
[Purchases] - DEBUG: ℹ️ Debug logging enabled
[Purchases] - DEBUG: ℹ️ SDK Version - 3.10.1
[Purchases] - DEBUG: 👤 Initial App User ID - <APP_USER_ID>
[Purchases] - DEBUG: ℹ️ PurchaserInfo cache is stale, updating caches
[Purchases] - DEBUG: ℹ️ Offerings cache is stale, updating caches
[Purchases] - DEBUG: ℹ️ Vending PurchaserInfo from cache.
[Purchases] - DEBUG: ℹ️ There are no requests currently running, starting request GET /subscribers/<APP_UESR_ID>
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/<APP_UESR_ID>
[Purchases] - DEBUG: ℹ️ API request started: GET /v1/subscribers/<APP_UESR_ID>/offerings
[Purchases] - DEBUG: ℹ️ No cached Offerings, fetching from network
[Purchases] - DEBUG: ℹ️ API request completed with status: GET /v1/subscribers/<APP_UESR_ID>/offerings 200
[Purchases] - DEBUG: ℹ️ Requesting products from the store with identifiers: {(
onetime,
annual,
onemonth
)}
[Purchases] - DEBUG: ℹ️ Products request finished.
[Purchases] - DEBUG: 💰 Retrieved SKProducts:
[Purchases] - DEBUG: 💰 onetime - <SKProduct: 0x600000308980>
[Purchases] - DEBUG: 💰 annual - <SKProduct: 0x600000308980>
[Purchases] - DEBUG: 💰 onemonth - <SKProduct: 0x600000308980>
[Purchases] - WARN: 🍎‼️ Invalid Product Identifiers - (
)
[Purchases] - DEBUG: ℹ️ 3 completion handlers waiting on products
[Purchases] - DEBUG: ℹ️ makePurchase
[Purchases] - DEBUG: 💰 Purchasing product from package - annual in Offering main
[Purchases] - DEBUG: ℹ️ PaymentQueue updatedTransaction: annual <TRANSACTION_ID> ((null)) (null) - 0
[Purchases] - DEBUG: 💰 Finishing transaction annual <TRANSACTION_ID> ((null))
[Purchases] - DEBUG: ℹ️ PaymentQueue removedTransaction: annual <TRANSACTION_ID> (null (null)) (null) - 1
Next Steps
- If you spotted any errors while debugging, make sure you're handling errors correctly
- You've verified that Purchases is running correctly, time to start making purchases in sandbox
Updated about 1 month ago