ExamGecko
Question list
Search
Search

Question 97 - Certified B2B Commerce Developer discussion

Report
Export

Which two usages of ccLog should be avoided in Salesforce B2B Commerce? (2 answers)

A.
ccrz.ccLog.log(System.LoggingLevel.ERROR, 'D:something', myCallToGetMessage(pl) ), where myCallToGetMessage(pl) is a method invocation
Answers
A.
ccrz.ccLog.log(System.LoggingLevel.ERROR, 'D:something', myCallToGetMessage(pl) ), where myCallToGetMessage(pl) is a method invocation
B.
crz.ccLog.log(System.LoggingLevel.WARN, 'D:something', 'Something unexpected occurred: The data we were expecting for pl was not there,')
Answers
B.
crz.ccLog.log(System.LoggingLevel.WARN, 'D:something', 'Something unexpected occurred: The data we were expecting for pl was not there,')
C.
crz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrderList', myOrderList), where myOrderList is a list of orders
Answers
C.
crz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrderList', myOrderList), where myOrderList is a list of orders
D.
crz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrder', myOrder), where myOrder is an order object
Answers
D.
crz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrder', myOrder), where myOrder is an order object
Suggested answer: A, C

Explanation:

You should avoid using ccLog in two scenarios. First, you should avoid using ccLog with System.LoggingLevel.ERROR when passing in a method invocation as the third parameter, such as ccrz.ccLog.log(System.LoggingLevel.ERROR, 'D:something', myCallToGetMessage(pl) ). This is because if an exception occurs within the method invocation, it will not be caught by ccLog and will cause an unhandled exception on the page. Instead, you should use a try-catch block around the method invocation and log the exception separately. Second, you should avoid using ccLog with System.LoggingLevel.DEBUG when passing in a large collection or object as the third parameter, such as ccrz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrderList', myOrderList), where myOrderList is a list of orders. This is because logging large objects can cause performance issues and consume a lot of heap space. Instead, you should use a loop to log only the relevant fields or properties of the object or collection. You can use ccLog with System.LoggingLevel.WARN when passing in a string as the third parameter, such as ccrz.ccLog.log(System.LoggingLevel.WARN, 'D:something', 'Something unexpected occurred: The data we were expecting for pl was not there,'). This is a valid use case for logging a warning message. You can also use ccLog with System.LoggingLevel.DEBUG when passing in a small object as the third parameter, such as ccrz.ccLog.log(System.LoggingLevel.DEBUG, 'D:myOrder', myOrder), where myOrder is an order object. This is acceptable as long as the object is not too large or complex. Salesforce

Reference: [B2B Commerce Developer Guide: Logging]

asked 23/09/2024
Knowledge Mathebula
35 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first