Which method is used to log into a custom file with a custom attribute?

Prepare for the SFCC Digital Developer Exam with our interactive quiz. Study using flashcards and multiple choice questions, each providing insightful hints and explanations. Ace your exam with confidence!

The method that allows logging a custom message along with a custom attribute is effectively conveyed through the choice stating Logger.getLogger('profile').debug('hello:{0}', https.statusCode). This option employs a formatted logging statement, which not only provides a message ('hello') but also incorporates the value of https.statusCode.

Using the format specifier {0}, the logging method can dynamically insert the runtime value of https.statusCode into the log message. This enhances the readability and usefulness of the logs, allowing better debugging and monitoring by providing more context surrounding the logged information.

In contrast, the other options do not incorporate a dynamic custom attribute in such a manner. For example, while one method mentions a custom message, it does not include formatted attributes. Without the use of at least one formatting placeholder and an associated variable to fill it, the logs would not include the dynamic data required for precise debugging. Therefore, choice C stands out as the method that effectively logs a message along with a custom attribute.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy