A Digital Developer needs to add logging to the following code:

Which statement logs the HTTP status code to a debug-level custom log file?
Correct Answer: D
In Salesforce B2C Commerce, logging is implemented via the Logger class available through the dw.system.Logger module. The correct way to log messages is to use the getLogger() method to retrieve an instance of a logger configured for a specific category, followed by one of the log level methods such as debug(). The logging statement must correctly format the message and include dynamic data like the HTTP status code.
In the options given:
* Option A incorrectly uses logger.getLogger() and the debug method does not properly format the message with the status code.
* Option B uses logger.debug() without obtaining a logger instance specific to a category which does not match the given syntax of dw.system.Logger.
* Option C lacks the specific category 'profile' needed for getLogger() method.
* Option D is correct because it uses Logger.getLogger('profile').debug(), which correctly references a specific logger category and uses the placeholder {0} for the status code. This matches the Salesforce Commerce Cloud's way of handling log messages with parameterized data.