Skip to content

Suggestion: Provide an option for minimal stacktrace output in Spring Boot error logging #46982

@dhruv-15-03

Description

@dhruv-15-03

Feature Request: Minimal Startup Error Output for Easier Debugging

Description

When an application fails to start, Spring Boot currently prints the entire exception chain with very long stacktraces (often dozens of lines). While this is thorough and valuable for advanced debugging, it can be overwhelming and noisy for most developers, especially when the actionable cause is buried deep in the logs.

For example, a simple misconfiguration in the datasource URL currently produces output spanning 50+ lines, even though the key message is just:

Caused by: java.lang.RuntimeException: Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, ${DB_URL}

Proposal

Introduce a configuration property (e.g., spring.main.minimal-errors=true) that changes startup error reporting to display a minimal root cause summary (3–5 lines). Developers could still opt in to the full stacktrace by enabling debug mode (--debug) or via a property (e.g., spring.main.full-errors=true).

This approach would follow the model of other developer tools (e.g., Maven/Gradle), which default to concise error summaries but provide full logs on demand.

Benefits

  • Improves developer experience: Makes it faster to identify the actual cause of startup failures.
  • Reduces noise: Cleaner console output, especially helpful in CI/CD logs.
  • Beginner-friendly: Lowers the intimidation factor for new developers learning Spring Boot.
  • Optional behavior: Full stacktraces remain available when needed.

Example of Expected Minimal Output

Application failed to start

Reason:
Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, ${DB_URL}

Fix:
Check your datasource URL configuration in application.properties

Notes

  • This would be an optional feature, not a breaking change.
  • Could default to "full error output," but allow toggling to "minimal" mode.
  • Would be consistent with Spring Boot’s philosophy of developer friendliness and convention over configuration.

🙏 Thanks for considering this! A minimal error reporting option would make Spring Boot startup failures much easier to digest while still preserving the ability to view full stacktraces when needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: declinedA suggestion or change that we don't feel we should currently apply

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions