Bird
0
0

Which of the following is the correct way to log an info message in Spring Boot using SLF4J?

easy📝 Syntax Q12 of 15
Spring Boot - Logging
Which of the following is the correct way to log an info message in Spring Boot using SLF4J?
Alogger.info("Application started successfully");
Blogger.logInfo("Application started successfully");
Clogger.printInfo("Application started successfully");
Dlogger.writeInfo("Application started successfully");
Step-by-Step Solution
Solution:
  1. Step 1: Recall SLF4J logging syntax

    The SLF4J logger uses methods like info(), debug(), error() to log messages at different levels.
  2. Step 2: Identify the correct method name

    The correct method to log an info message is info(), so logger.info("message") is correct.
  3. Final Answer:

    logger.info("Application started successfully"); -> Option A
  4. Quick Check:

    SLF4J info method = info() [OK]
Quick Trick: Use logger.info() for info messages in Spring Boot [OK]
Common Mistakes:
  • Using incorrect method names like logInfo or printInfo
  • Confusing logging methods with print statements
  • Missing parentheses after method name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes