Bird
0
0

Which of the following is the correct way to set a simple console log pattern in application.properties?

easy📝 Syntax Q12 of 15
Spring Boot - Logging
Which of the following is the correct way to set a simple console log pattern in application.properties?
Aconsole.logging.pattern=%date %level %logger %message
Blogging.pattern.console=%d{HH:mm:ss} %-5level %logger{36} - %msg%n
Clogging.console.pattern=%d{HH:mm:ss} %level %logger - %msg
Dlogging.pattern=%d %level %logger %msg
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct property key for console log pattern

    The correct key is logging.pattern.console in Spring Boot.
  2. Step 2: Check the pattern syntax

    The pattern uses placeholders like %d for date, %-5level for log level, %logger{36} for logger name, and %msg for message, ending with %n for newline.
  3. Final Answer:

    logging.pattern.console=%d{HH:mm:ss} %-5level %logger{36} - %msg%n -> Option B
  4. Quick Check:

    Correct property and pattern syntax = logging.pattern.console=%d{HH:mm:ss} %-5level %logger{36} - %msg%n [OK]
Quick Trick: Use logging.pattern.console for console logs in application.properties [OK]
Common Mistakes:
  • Using wrong property keys like logging.console.pattern
  • Missing newline %n at the end
  • Incorrect placeholder syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes