Bird
0
0

Given this Spring Boot code snippet:

medium📝 component behavior Q13 of 15
Spring Boot - Logging
Given this Spring Boot code snippet:
logger.debug("Debug message");
logger.info("Info message");
logger.error("Error message");

If the log level is set to INFO, which messages will appear in the logs?
AInfo message, Error message
BOnly Error message
CDebug message, Info message, Error message
DOnly Debug message
Step-by-Step Solution
Solution:
  1. Step 1: Understand log level filtering

    Setting level to INFO shows logs at INFO and higher severity (WARN, ERROR).
  2. Step 2: Check which messages qualify

    DEBUG is lower than INFO, so it is hidden; INFO and ERROR show.
  3. Final Answer:

    Info message, Error message -> Option A
  4. Quick Check:

    INFO level shows INFO and ERROR logs [OK]
Quick Trick: Logs show messages at set level and above [OK]
Common Mistakes:
  • Assuming DEBUG logs show at INFO level
  • Thinking ERROR logs are hidden at INFO level
  • Confusing INFO with DEBUG level

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes