---
schema_version: "1"
id: 90f72b682ca6551ff3b67af6ed46b76b5c4c8306db496121857c3a011d79e213
title: Debugging
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/interactions-sdk/guides/c360a-api-debugging.md
canonical_url: https://developer.salesforce.com/docs/data/salesforce-interactions-sdk/guide/c360a-api-debugging.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 825ae419c519385564c758214d5f8d25e159bd5974ca02e6656b33054ea25820
products:
  - Salesforce Interactions SDK
  - Data 360 Developer Documentation
---
# Debugging

Salesforce Interactions SDK provides an in-built logger that outputs messages to the browser console for debugging purposes. This logger wraps the standard browser `console.log` function and is accessible via `SalesforceInteractions.log`.

By default, the SDK is configured with a logging level of `none` (0), meaning the logger doesn't output messages until you explicitly configure a higher logging level.

## Logging Levels

The logging level controls the verbosity of the debug output. Setting a log level displays all messages at that level and any lower levels. For example, setting the level to `warn` (2) will also display `error` (1) messages.

| Level   | Value | Description                                                                      |
| ------- | ----- | -------------------------------------------------------------------------------- |
| `trace` | 5     | Used for finer-grained, highly-detailed informational messages than `debug`.     |
| `debug` | 4     | Used for fine-grained messages during development and debugging.                 |
| `info`  | 3     | Used for standard informational messages about the SDK's operation.              |
| `warn`  | 2     | Used to surface potential issues with the Web SDK that can affect functionality. |
| `error` | 1     | Used for error events that indicate the Web SDK isn’t functioning properly.      |
| `none`  | 0     | **Default**. Disables all logging output.                                        |

## Logging Methods

### setLoggingLevel()

Use this method to change the SDK's logging level.

```javascript
setLoggingLevel(level?: LoggingLevel | keyof typeof LoggingLevel): void
```

You can use either use the name of the logging level or the numeric value.

```javascript
// Example: Enable error messages and anything more severe
SalesforceInteractions.setLoggingLevel("error");

// Same as above, using the numeric value
SalesforceInteractions.setLoggingLevel(1);
```

### getLoggingLevel()

Use this method to return the numeric value of the current logging level used by the SDK.

```javascript
getLoggingLevel(): LoggingLevel
```

Here's an example of how you can use the `getLoggingLevel()` method.

```javascript
SalesforceInteractions.getLoggingLevel();
// => 1 (if set to 'error')
```

## Manual Logging Methods

Use the `SalesforceInteractions.log` object to output your own custom messages from your site's code. These messages will only appear in the browser console if the SDK's configured logging level is set to match or exceed the level of the method you call.

| Method                            | Level       | Description                            | Example                                                                             |
| --------------------------------- | ----------- | -------------------------------------- | ----------------------------------------------------------------------------------- |
| `log.trace(...args: any[]): void` | 5 (Highest) | Prints a message at the `trace` level. | `SalesforceInteractions.log.trace("Deep trace details.")`                           |
| `log.debug(...args: any[]): void` | 4           | Prints a message at the `debug` level. | `SalesforceInteractions.log.debug("Hello!")`                                        |
| `log.info(...args: any[]): void`  | 3           | Prints a message at the `info` level.  | `SalesforceInteractions.log.info("Sitemap initialization complete.")`               |
| `log.warn(...args: any[]): void`  | 2           | Prints a message at the `warn` level.  | `SalesforceInteractions.log.warn("Missing optional user attribute: phone number.")` |
| `log.error(...args: any[]): void` | 1 (Lowest)  | Prints a message at the `error` level. | `SalesforceInteractions.log.error("An API call failed during checkout.")`           |
