Cert++
Close

Custom error logs versus system error logs for controller exceptions

Key Takeaway

To find where a controller or script exception was thrown, look in the custom error log (customerror_* files), because it shows the function chain and the line numbers. Use try/catch to handle a failing call, and use Logger.error to record the details in that same log.

B2C Commerce writes controller and script exceptions to log files, and two error logs hold them. The custom error log is the one built for developers, because it points to the functions and lines behind a failure. The system error log holds Java-related errors and is mainly used by B2C Commerce Support. When a controller fails, you need to know which log to open and how to write your own entries into it.

Two types of logging

B2C Commerce has two types of logging. System logging is on by default. Only Salesforce Support can change its configuration. Custom logging covers programmatic logging from script files. You configure custom logging in Business Manager.

When a controller or script throws an exception, B2C Commerce writes it to log files. Two error logs matter here:

Custom error logSystem error log
Filescustomerror_*error_*
What it holdsAlmost any JavaScript-related error, including errors from B2C Commerce scripts and controllersJava-related errors on B2C Commerce
Who it's forDevelopersPrimarily B2C Commerce Support

Almost any JavaScript-related error lands in the custom error log, so it is the first place to look when a controller fails. The system error log is usually less useful to developers outside Salesforce.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.