View client-side error logs

Client-side errors are stored in log files that roll over every day.

Commerce stores 30 days’ worth of these logs files. To access the log files, both the Store API and the Admin API have a logging endpoint. The syntax for requests sent to these endpoints is the same, as shown in the following example:

GET /logging?type=clientErrors

A request to the Store API logging endpoint should be sent to a storefront server where it retrieves client errors logged on that server, for example:

["log line 1",
"log line 2",
"log line 3"]

A request to the Admin API logging endpoint should be sent to the administration server. The Admin API logging endpoint executes concurrent REST requests to retrieve client errors from each registered storefront server. The Admin API endpoint collates the results from the store requests and returns them as one JSON object, keyed on the hostname of the storefront server, for example:

{
  "server 1": ["log line 1",
  "log line 2",
  "log line 3"],
  "server 2": ["log line 1"]
}

The log information returned by either endpoint can be filtered using the optional query parameters described in the following table:

Parameter Format Default Description
since ISO 8601 timestamp format OR millisecond value null The date and time to start searching from.
until ISO 8601 timestamp format OR millisecond value null The date and time to search to.
includeArchives boolean false Controls whether the search includes archived log files.
numArchiveFiles int 7 Searches the most recent N archived log files. A value of 0 searches all archived log files.
queryText String null Limits the results to log entries containing the supplied query text.
localLogs boolean false This parameter is supported by the Admin API endpoint only. It returns errors from the local log file on the administration server, without calling out to the storefront servers. You can use it to retrieve client-side errors thrown by the storefront preview feature.