Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Certified B2C Commerce Cloud Developer (Comm-Dev-101) Exam - Topic 1 Question 97 Discussion

A developer is asked to write a log containing the ID and name of the product with a variable named myProduct.Which snippet of code should be used?
A) Logger.warn('The current producto is {0} with name {1}', myProduct.getID(), myProduct.getName());
B) Logger.warn('The current producto is {0} with name {1}'), context(myProduct.getID(), myProduct.getName());
C) Logger.warn('The current producto is ${myProduct.getID()} with name ${myProduct.getName()}');
D) Logger.warn('The current producto is %s with name %s'), context(myProduct.getID(), myProduct.getName());

Salesforce Certified B2C Commerce Cloud Developer (Comm-Dev-101) Exam - Topic 1 Question 97 Discussion

Actual exam question for Salesforce's Salesforce Certified B2C Commerce Cloud Developer (Comm-Dev-101) exam
Question #: 97
Topic #: 1
[All Salesforce Certified B2C Commerce Cloud Developer (Comm-Dev-101) Questions]

A developer is asked to write a log containing the ID and name of the product with a variable named myProduct.

Which snippet of code should be used?

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

0/2000 characters
Kristofer
2 months ago
I feel like option C is modern and easy to read.
upvoted 0 times
...
Haydee
2 months ago
Option D is confusing. The parentheses are off.
upvoted 0 times
...
Twanna
2 months ago
I agree with Stephane. A is straightforward and effective.
upvoted 0 times
...
Candra
2 months ago
Option B seems wrong. The context function is misplaced.
upvoted 0 times
...
Angelyn
3 months ago
A is definitely the way to go, it’s straightforward!
upvoted 0 times
...
Omega
3 months ago
I disagree, B seems off with that context function.
upvoted 0 times
...
Avery
3 months ago
Wait, is "producto" a typo? Shouldn't it be "product"?
upvoted 0 times
...
Yolande
4 months ago
I think C is the best choice, it’s cleaner with template literals.
upvoted 0 times
...
Glenna
4 months ago
Option A looks solid, using the right method for logging.
upvoted 0 times
...
Linwood
4 months ago
C) for the win! Who needs all that extra syntax when you can just use string interpolation?
upvoted 0 times
...
Mozelle
4 months ago
C) is the clear winner here. Simple and effective.
upvoted 0 times
...
Bettina
4 months ago
I'd go with C) to keep the code clean and readable.
upvoted 0 times
...
Dion
4 months ago
C) looks the most straightforward.
upvoted 0 times
...
Wei
5 months ago
I thought we were supposed to use placeholders like `%s` in logging, so option D seems plausible, but I can't remember if the parentheses are correct there.
upvoted 0 times
...
Belen
5 months ago
I'm a bit confused about the use of `context()` in options B and D. I don't recall seeing that in our examples.
upvoted 0 times
...
Regenia
5 months ago
I think option A looks familiar, but I'm not sure if the syntax is exactly right for the logger function.
upvoted 0 times
...
Alba
5 months ago
This seems simple enough, but I want to make sure I'm not missing any subtle details. I'll carefully consider each option before making my choice.
upvoted 0 times
...
Aleisha
5 months ago
I'm a little unsure about the correct way to use the logger here. I'll need to review the documentation to make sure I understand the different formatting options.
upvoted 0 times
...
Georgiana
5 months ago
I prefer option C. It looks cleaner with template literals.
upvoted 0 times
...
Stephane
6 months ago
I think option A is the best. It uses the correct syntax.
upvoted 0 times
...
Elmer
6 months ago
Ah, I've seen this type of question before. I'm pretty confident I can figure this out. Time to put my coding skills to the test!
upvoted 0 times
...
Tracey
6 months ago
C) is the way to go. No need to get fancy with string formatting.
upvoted 0 times
...
Floyd
6 months ago
I remember practicing a question similar to this, and I feel like using `${}` for variables might be the way to go, which makes me lean towards option C.
upvoted 0 times
...
Caprice
6 months ago
Okay, let's see here. I think I know the answer, but I want to double-check the syntax for string formatting in the logger. I don't want to mess this up.
upvoted 0 times
...
Nadine
7 months ago
Hmm, this looks like a straightforward logging question. I'll need to carefully read through the options and think about the best way to format the log message.
upvoted 0 times
Gaston
30 days ago
I’m leaning towards A as well. It just makes sense!
upvoted 0 times
...
Aleisha
1 month ago
D has a nice structure, but it’s not as clear as A.
upvoted 0 times
...
Rodolfo
1 month ago
Option C seems interesting too, but I prefer A for clarity.
upvoted 0 times
...
Julian
2 months ago
I agree, A looks clean and straightforward.
upvoted 0 times
...
Stephane
2 months ago
I think option A is the best choice. It uses the right format for logging.
upvoted 0 times
...
...

Save Cancel