Storefront Next includes a built-in structured logger that outputs JSON to stdout. The logger automatically enriches each log entry with a correlation ID and request context, making requests easy to trace across your application and search in Log Center.
Use the Logger
Server-Side (Loaders, Actions, Middleware)
Use getLogger(context) to get a request-scoped logger. It automatically includes the correlation ID, HTTP method, and path in every log entry.
In development, logs are pretty-printed with colors and timestamps for readability.
Correlation ID
Every incoming request is assigned a correlation ID — either extracted from the x-correlation-id request header or generated automatically. All log entries for that request share the same correlationId, which lets you trace a single request end to end.
View Logs in Log Center
Log Center lets you search and filter production logs from Managed Runtime and your B2C Commerce instance.
Prerequisites
To access MRT logs in Log Center:
Have the Log Center User role in Account Manager. If you don’t have the role, ask your Account Manager admin to give you access.
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. There can be a delay of up to 15 minutes between an event and the log appearing in Log Center.