Logging and Debugging (Version 3.x)
Logging is an important SDK feature that lets you control the verbosity of the SDK’s output. By default, logging is disabled. You must enable it by defining a log level and output destination using the setLogger method for iOS or setLogging method for Android on the SFMCSdk instance. Once enabled, the SDK uses the native unified logging system to capture log output.
| Log Level | Description |
|---|---|
Error | Details unrecoverable errors that prevent key functionalities from working. |
Warn | Highlights potential problems or unexpected situations. These are typically recoverable issues that won’t stop the SDK from functioning but should be addressed. |
Debug | Provides detailed, low-level information about the SDK’s internal operations. Use this level for in-depth troubleshooting and diagnostics. |
Here’s how you can enable and use logging in your application.
The state property of the Data 360 Module returns operational information containing current configuration settings, session details, event queue size, and consent state. This information is critical for debugging and troubleshooting purposes.
There are two equivalent ways to access the Data 360 Module after initialization:
SFMCSdk.cdp— access via the unified SFMCSDK namespace (preferred for consistency with other modules)CdpModule.shared(iOS) /CdpSdk.requestSdk(Android) — direct singleton access
Both refer to the same module instance.
Always inspect the SDK state during debugging to verify your configuration and understand the SDK’s current status.
locationManageris an empty object{}when no location is set or it has expired.consentManager.partyIdentificationUserIdis populated when the SFMCSDK push module has set a subscriber key.- When the tenant has been deprovisioned (server returned 401 with
APP_SOURCE_UNKNOWN), the entirestatestring is"Deprovisioned"(not JSON). expirationinlocationManageris a Unix timestamp (seconds since epoch).
locationManagerfields are omitted when no location is set.moduleStatevalues areINITIALIZING,READY, andTENANT_DEPROVISIONED.