What logs will be written if the log category is set to "root" and log level to WARN, when executing log.warn() and log.error() commands?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Salesforce Commerce Cloud Developer Certification Exam. Study with flashcards and multiple choice questions, each offering hints and detailed explanations. Elevate your skills and confidence to succeed on your exam!

When the log category is set to "root" and the log level is set to WARN, the logging framework is configured to capture warnings and errors. In this context, the log.warn() command is executed to log a warning message, and because the current log level allows for warnings to be logged, this message will appear in the logs.

The log.error() command can also be executed in this scenario. Since errors are of a higher severity than warnings, this message will also be written to the logs. Consequently, both the log.warn() and log.error() commands will successfully generate entries in the log files.

However, if log.info() or log.debug() commands are executed, these would not produce any entries in the logs. This is because they operate at levels lower than WARN, and since the logging configuration is set to only capture warnings and above, those messages would be ignored. Therefore, only log.warn() and log.error() will lead to log entries being created under the specified configuration.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy