Bird
0
0

Given the following Spring Boot code snippet, what will be the output if the log level is set to WARN?

medium📝 Command Output Q13 of 15
Spring Boot - Logging
Given the following Spring Boot code snippet, what will be the output if the log level is set to WARN?
logger.info("Info message");
logger.warn("Warning message");
logger.error("Error message");
ANo output
BInfo message, Warning message, Error message
CError message only
DWarning message, Error message
Step-by-Step Solution
Solution:
  1. Step 1: Understand log level filtering

    When log level is set to WARN, only messages with level WARN and ERROR (higher severity) are shown.
  2. Step 2: Identify which messages appear

    Info messages are below WARN level, so they are ignored. Warning and error messages are shown.
  3. Final Answer:

    Warning message, Error message -> Option D
  4. Quick Check:

    Log level WARN shows WARN and ERROR [OK]
Quick Trick: Log level filters out lower severity messages [OK]
Common Mistakes:
  • Expecting info messages to appear at WARN level
  • Confusing log levels order
  • Assuming all messages always print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes