Salesforce B2C Commerce 23.5 > Developing Your Site > Development Components > Scripts > Script Programming > Understanding Server-Side JavaScript > Custom Log Categories

Adding Logging to Your Scripts

You can add logging to scripts.

The dw.system.Logger class includes the following methods:

The dw.system.Log class lets you write to a specific log level and category. This class has the following methods:

For NDC support, the static method LogNDC getNDC() provides access to the NDC. The NDC property supports access to the nested diagnostic context.

The following methods are instance methods and not class methods:

Note: Fatal is always enabled.

The API class dw.system.LogNDC has the following methods.

Method Description
push( String message ) : void Pushes new diagnostic context information for the current script execution.
peek() : String Looks at the last diagnostic context at the top of this NDC without removing it. The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.
pop() : String Call this method before leaving a diagnostic context. The returned value is the value that was pushed last. If no context is available, then the empty string "" is returned.
remove() : void Removes the diagnostic context for this script call.
X Privacy Update: We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used. By continuing to use this site you are giving us your consent to do this. Privacy Policy.