Bird
0
0

How can you configure Spring Boot to write logs to a file instead of the console?

hard📝 Application Q9 of 15
Spring Boot - Logging
How can you configure Spring Boot to write logs to a file instead of the console?
ASet 'logging.file.name' property in application.properties
BUse System.out.println instead of logger
CDisable logging in application.properties
DSet 'spring.output.file' property
Step-by-Step Solution
Solution:
  1. Step 1: Identify Spring Boot property for file logging

    Property 'logging.file.name' sets the log output file path.
  2. Step 2: Check other options

    System.out.println is not logging; disabling logging stops logs; 'spring.output.file' is not a valid property.
  3. Final Answer:

    Set 'logging.file.name' property in application.properties -> Option A
  4. Quick Check:

    Use logging.file.name to log to file [OK]
Quick Trick: Configure logging.file.name to save logs to a file [OK]
Common Mistakes:
  • Using print statements instead of logger
  • Disabling logging to save logs
  • Using wrong property names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes