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 LevelDescription
ErrorDetails unrecoverable errors that prevent key functionalities from working.
WarnHighlights potential problems or unexpected situations. These are typically recoverable issues that won’t stop the SDK from functioning but should be addressed.
DebugProvides 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.

  • locationManager is an empty object {} when no location is set or it has expired.
  • consentManager.partyIdentificationUserId is 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 entire state string is "Deprovisioned" (not JSON).
  • expiration in locationManager is a Unix timestamp (seconds since epoch).
  • locationManager fields are omitted when no location is set.
  • moduleState values are INITIALIZING, READY, and TENANT_DEPROVISIONED.