Spring Boot FAQ: Top Questions
11. How does Spring Boot handle logging?
Spring Boot uses Apache Commons Logging for internal logging and defaults to Logback for runtime logging. It supports logging configuration using application.properties
, logback.xml
, or log4j2.xml
.
📘 Default Behavior:
- Outputs logs to console.
- Logback is used as the default logging framework.
- Supports log level configuration per package or class.
📥 Example:
logging.level.org.springframework=DEBUG
logging.level.com.myapp=INFO
🏆 Expected Output:
DEBUG logs from Spring and INFO logs from your app appear in console.
🛠️ Use Cases:
- Debugging issues in development.
- Monitoring logs in production environments.