Bird
0
0

Find the problem in this logging statement:

medium📝 Troubleshoot Q7 of 15
Spring Boot - Logging
Find the problem in this logging statement:
logger.info("User ID: {}", userId, extraParam);
AToo many parameters for placeholders
BMissing placeholder for extraParam
CLogger not initialized
DIncorrect log level
Step-by-Step Solution
Solution:
  1. Step 1: Count placeholders and parameters

    There is one placeholder '{}' but two parameters after the message.
  2. Step 2: Understand SLF4J formatting rules

    Number of placeholders must match parameters; extra parameters cause errors or ignored values.
  3. Final Answer:

    Too many parameters for placeholders -> Option A
  4. Quick Check:

    Parameter count must match placeholders [OK]
Quick Trick: Match placeholders '{}' with parameters exactly [OK]
Common Mistakes:
  • Adding extra parameters without placeholders
  • Forgetting placeholders
  • Not initializing logger

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes