---
schema_version: "1"
id: f46b6ff326447d99736c90b75aa0768126a9e48204c1f51956257b39ff36be0e
title: Debug Your Storefront Next Site Using Log Center
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/commerce-cloud/sfnext/guides/sfnext-debug-log-center.md
canonical_url: https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-debug-log-center.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7425ff442d80c5accd8e41ed3b4a871ed105c8deaf3276be213acdb9447381cc
products:
  - Composable Storefront
  - Salesforce APIs
---
# Debug Your Storefront Next Site Using Log Center

Use [Log Center](https://help.salesforce.com/s/articleView?id=cc.b2c_log_center.htm&type=5) to debug production issues for sites built using Storefront Next. Log Center aggregates logs from Managed Runtime (MRT) and your B2C Commerce instance in one place.

Log Center:

- Provides a single location to access logs from MRT and your B2C Commerce instance, so you can connect what's happening in your MRT environment with what's going on in your B2C Commerce instance.
- Lists Shopper Login and API Access (SLAS) errors. See [View SLAS Error Logs in Log Center](https://developer.salesforce.com/docs/commerce/commerce-api/guide/slas.html#view-slas-error-logs-in-log-center).
- Displays CDN error logs (status code `5xx`), which help you troubleshoot content delivery and performance issues.
- Lets you [search](https://help.salesforce.com/s/articleView?id=cc.b2c_log_center_search.htm&type=5) and filter many historical logs, so you can investigate and resolve issues faster.

**note:** - MRT logs in Log Center are available for any environment with Log Center logs enabled and a B2C Commerce instance associated. Marking the environment as production isn't required. See [Prerequisites](#log-center-prerequisites).
- There can be a delay of up to 15 minutes between the time that an event happens and the log appears in Log Center.

For information about the Storefront Next structured logger and log levels, see [Logging in Storefront Next](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-logging.md).

## Log Center Prerequisites

To access MRT logs for an environment in Log Center, first:

1. Have the **Log Center User** role in Account Manager. To verify, check your role in [Account Manager](https://account.demandware.com/). If you don't have the role, ask your Account Manager admin to give you access. See [Managing Account Manager for Salesforce B2C Commerce Users](https://help.salesforce.com/s/articleView?id=000391212&type=1).
2. Create an environment. See [Create an Environment in Business Manager](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-mrt-create-environment.md).

   Creating an environment in Business Manager associates the B2C Commerce instance and site IDs to the environment, which are prerequisites for Log Center logging.

3. Enable Log Center logs and Log Center metrics under Observability in Environment Settings. [DOUBLE CHECK THIS]

## View Logs

After you complete the [Prerequisites](#log-center-prerequisites), to view MRT logs in Log Center:

1. Open [Log Center](https://help.salesforce.com/s/articleView?id=cc.b2c_start_log_center.htm&type=5).
2. Select a **Region**.
3. Select a **[Realm](https://help.salesforce.com/s/articleView?id=cc.b2c_platform_overview.htm&type=5)**. If you don't know your realm ID, ask your Salesforce account executive (AE) or customer success manager (CSM).
4. Click **Show filtered results**.
5. Click **Search > Current Search**.
6. Under Service Type, select **mrt** for Managed Runtime logs.
7. Under Request Type, select **SSR** for application logs or **CDN** for CDN logs.
8. Under Host, select the environment whose logs you want to see. The format of the host is `$PROJECT.$ENVIRONMENT`. If you have more than one MRT environment with Log Center logs enabled, you see multiple MRT host names.
9. View the MRT logs.

   Storefront Next emits logs in structured JSON format—one JSON object per line. Each line includes these fields.

   | Field           | Description                                                                                                                                   |
   | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
   | `level`         | Log severity: `error`, `warn`, `info`, or `debug`.                                                                                            |
   | `msg`           | The log message.                                                                                                                              |
   | `correlationId` | A unique ID assigned per request. All log entries for a single request share the same `correlationId`, so you can trace a request end to end. |
   | `method`        | The HTTP method, for example, `GET` or `POST`.                                                                                                |
   | `path`          | The URL pathname of the request.                                                                                                              |

   For example:

   ```json
   {
     "level": "warn",
     "correlationId": "a1b2c3",
     "method": "GET",
     "path": "/product/25518447M",
     "msg": "Product not found"
   }
   ```

   To narrow results to a specific request, filter on `correlationId`. To narrow results to a specific route, filter on `path` or `method`.

   **note:** The log level defaults to `warn` in production and `info` in other environments. The `SFCC_LOG_LEVEL` environment variable controls the log level. If you don't see expected log entries, check that the log level for your environment is set appropriately. See [Configure the Log Level](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-logging.md#configure-the-log-level).

10. (Optional) Generate logs for a specific component or third-party integration by using a custom field to make log filtering easier. Log Center lets you filter on the custom field to find all logs from a specific area of your codebase.

    For server-side code in loaders, actions, or middleware, use `getLogger(context)`. In this example, the custom field in the log call is `component`.

    ```typescript
    import { getLogger } from "@/lib/logger.server";

    export async function loader({ context }: LoaderFunctionArgs) {
      const logger = getLogger(context);
      if (err.code === "MISSING_DESCRIPTION") {
        logger.warn("Missing description", {
          component: "CmsProductDescription",
          errorCode: err.code,
        });
      }
    }
    ```

    For module-scope or client-side code where router context isn't available, use `createLogger()`:

    ```typescript
    import { createLogger } from "@/lib/logger";

    const logger = createLogger({ component: "CmsProductDescription" });
    logger.warn("Missing description", { errorCode: err.code });
    ```

    In both cases, the `component` field, or any custom field you add, appears in every log line and is searchable in Log Center.

## Limitations

- **Managed Runtime:** Each MRT log message available when you tail logs or use Log Center is limited to 32 KB. Characters over 32 KB are truncated. To avoid truncated messages, tail logs in a non-production environment and shorten any long messages. See [Tail Logs](https://salesforcecommercecloud.github.io/b2c-developer-tooling/cli/mrt.html#b2c-mrt-tail-logs) in the Agentic B2C Developer Toolkit.
- **Log Center:** For information about log levels and log volumes, see [Configuration for Administrators](https://help.salesforce.com/s/articleView?id=cc.b2c_configuration_for_administrators.htm&type=5).

## See Also

- [Logging in Storefront Next](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-logging.md)
- [Debug Your Storefront Locally](https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/sfnext-debug-locally.md)
