Challenge - 5 Problems
File-based Logging Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Log file creation with default Spring Boot logging
You run a Spring Boot application without any custom logging configuration. Which file will be created by default to store logs?
Attempts:
2 left
💡 Hint
Think about what Spring Boot does if you don't specify any logging file path.
✗ Incorrect
By default, Spring Boot logs only to the console unless you configure a file appender. No log file is created automatically.
❓ Configuration
intermediate2:00remaining
Configuring log file location in application.properties
Which property correctly configures Spring Boot to write logs to a file named 'myapp.log' in the 'logs' folder?
Attempts:
2 left
💡 Hint
Check the exact property name for specifying the log file name.
✗ Incorrect
The property 'logging.file.name' sets the full path and filename for the log file. 'logging.file.path' sets only the directory.
❓ Troubleshoot
advanced2:00remaining
Log file not created despite configuration
You set 'logging.file.name=logs/app.log' in application.properties, but no log file appears after running the app. What is the most likely cause?
Attempts:
2 left
💡 Hint
Think about folder creation behavior for log files.
✗ Incorrect
Spring Boot does not create missing directories for log files automatically. The 'logs' folder must exist before running the app.
🔀 Workflow
advanced3:00remaining
Steps to enable rolling log files in Spring Boot
What is the correct order of steps to configure rolling log files using Logback in Spring Boot?
Attempts:
2 left
💡 Hint
Think about creating config, defining appender, linking it, then restarting.
✗ Incorrect
First create the config file, then define the appender, link it to the logger, and finally restart the app to apply.
✅ Best Practice
expert3:00remaining
Best practice for sensitive data in log files
Which approach is best to avoid logging sensitive information like passwords in Spring Boot file logs?
Attempts:
2 left
💡 Hint
Think about controlling what gets logged rather than disabling logging.
✗ Incorrect
A custom log filter can selectively mask or remove sensitive data, keeping logs useful and secure.