🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Docs and Production: all 10 questions

Quiz: Docs and Production · Question 9 of 10

In log.error("Payment failed for order {}", orderId, exception); why is the exception the last argument?

In log.error("Payment failed for order {}", orderId, exception); why is the exception the last argument?

  1. A.It is ignored there
  2. B.It replaces the {} placeholder
  3. C.SLF4J requires exactly two arguments
  4. D.SLF4J treats a final exception argument specially and logs its stack trace
Answer & explanation

Correct answer: SLF4J treats a final exception argument specially and logs its stack trace

Placeholders take the earlier arguments; the trailing exception is printed with its stack trace.

Can you get the rest right without peeking?

Take the timed Quiz: Docs and Production quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →