0
0
Spring Bootframework~20 mins

File-based logging in Spring Boot - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
File-based Logging Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2: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?
ANo log file is created by default; logs go to console only
Bapplication.log in the current directory
Clogs/app.log inside a logs folder
Dspring.log in the current directory
Attempts:
2 left
💡 Hint
Think about what Spring Boot does if you don't specify any logging file path.
Configuration
intermediate
2: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?
Alogging.file=logs/myapp.log
Blogging.path=logs/myapp.log
Clogging.file.path=logs/myapp.log
Dlogging.file.name=logs/myapp.log
Attempts:
2 left
💡 Hint
Check the exact property name for specifying the log file name.
Troubleshoot
advanced
2: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?
AThe log level is set to ERROR, so no logs are written
BThe 'logs' directory does not exist and Spring Boot does not create it automatically
CThe application.properties file is not in the classpath
DSpring Boot requires a separate logging framework dependency to write files
Attempts:
2 left
💡 Hint
Think about folder creation behavior for log files.
🔀 Workflow
advanced
3: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?
A1,3,2,4
B2,1,3,4
C1,2,3,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Think about creating config, defining appender, linking it, then restarting.
Best Practice
expert
3: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?
AUse a custom log filter to mask or remove sensitive data before writing logs
BSet logging.level.root=OFF to disable all logging
CWrite sensitive data only to console logs, not files
DEncrypt the entire log file after application shutdown
Attempts:
2 left
💡 Hint
Think about controlling what gets logged rather than disabling logging.