Logging helps developers to report information for debugging and monitoring purposes. commercetools Frontend supports logging out of the box, and you can find all the collected logs on your Kibana dashboard.
In this article, you'll learn about logging and tracing requests through different extensions like a
Logging in extensions
console global object.
|INFO||Information for debugging.|
|WARNING||Warnings and issues during execution.|
|ERROR||Error messages when execution fails.|
You'll see these logs inside the CLI inside the sandbox log (s)as shown below during development.
Use the up and down arrow keys to move up/down in the logs and press
Enter to see details of the selected log as shown below.
Checking logs in Kibana
Tracing a request
Sometimes you'd want to trace a request through different services and see where things went wrong. commercetools Frontend adds a unique
requestId to all requests that come to that API hub, making it easy to trace the request for debugging.
You can copy the
requestId from the request headers in the Network tab of the developer console as shown below.
You can also copy the
requestId from a log and use it to filter all logs related to that request.
The log severity will be set based on the method used while logging as shown in the image below.
You can expand the log to see more details. For example, the
context will have the object mentioned in the log.