Log Data During Development
To log data during development and debugging, use the console module available in Node.js and configure the Action Management JSON Editor to allow low priority logs to display in Dev Center:-
Open an action file in the
assets/srcdirectory and log data to the console usingconsole.logorconsole.info. A great use case for logging is to view what data thecontextobject provides different actions, as shown in the following two examples (which include an embedded action and an http action), but you can log just about any data you want.assets/src/domains/commerce.catalog.storefront.shipping/http.commerce.catalog.storefront.shipping.requestRates.after.js - Save the file.
- In Admin, go to System > Customization > API Extension****s to open the Action Management JSON Editor.
-
Set the
defaultLogLeveltoinfo, which allows low-priority logs to display in Dev Center. -
Run
gruntin your project directory to upload your assets with the new logging code. - In your sandbox, interact with your storefront so that the relevant action runs its custom function. For the preceding examples, you would add an item to the cart or proceed through the checkout process until the shipping rate information displays.
- In Dev Center, go to Logs > Action Logs.
- Select a tenant and click OK to view the logs for that tenant.
- Identify the logs generated by your function and click them to view details. A lot of the data relevant to applications is formatted as JSON. Kibo recommends you copy this data into an online JSON formatter for easier viewing.
Log Data on a Production Application
While logging data is useful during development, when your application is ready for production, you should make sure to:- Remove or comment out console statements from your code.
- In Admin, go to System > Customization > API Extensions to open the Action Management JSON Editor. Set the
defaultLogLeveltoerror, which allows only high-priority logs to display in Dev Center.

