Bird
0
0

Given this Spring Boot code snippet:

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

If the log level is set to WARN, which messages will be printed?
AWarning message and Error message only
BAll three messages
CError message only
DInfo message only
Step-by-Step Solution
Solution:
  1. Step 1: Understand log level filtering

    When log level is WARN, messages at WARN and higher (ERROR) are printed; lower levels like INFO are ignored.
  2. Step 2: Identify which messages match

    WARN and ERROR messages print; INFO does not.
  3. Final Answer:

    Warning message and Error message only -> Option A
  4. Quick Check:

    Log level WARN prints WARN and ERROR [OK]
Quick Trick: Log level shows messages at that level and above [OK]
Common Mistakes:
  • Including INFO messages at WARN level
  • Printing only ERROR messages
  • Printing all messages regardless of level

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes