-
Notifications
You must be signed in to change notification settings - Fork 41.7k
Format startup duration in human-readable units. #48515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Format startup duration in human-readable units. #48515
Conversation
8df1f91 to
ff5546a
Compare
|
Thanks for the PR. I am not sure we should do this, I suspect that some automated process out there is parsing the value. I'll flag for team attention to collect more feedback from the team. |
cd77cfc to
2174833
Compare
Thanks for the feedback! I completely understand the concern about backward compatibility with existing log parsing tools. I've updated the PR to address this by introducing a configuration option instead of changing the default behavior: New approach:
Key benefits:
This way, users who have long-running applications can opt into more readable startup logs without affecting anyone else. The configuration follows the same naming convention as "spring.main.log-startup-info". |
Introduce a new configuration property 'spring.main.log-startup-time-format' to control how application startup times are displayed in logs. This addresses concerns about backward compatibility with existing log parsing tools. The property supports two formats: - 'decimal' (default): Displays time in seconds with millisecond precision (e.g., "3.456 seconds"). This maintains backward compatibility. - 'human-readable': Displays time in a more intuitive way using appropriate units (e.g., "1 minute 30 seconds" or "1 hour 15 minutes"). By defaulting to the existing decimal format, this change ensures no breaking changes for existing deployments while providing an opt-in mechanism for users who prefer more readable startup time logs. Signed-off-by: Huang Xiao <youngledo@qq.com>
2174833 to
2f6030b
Compare
|
@youngledo please stop. There's no need to change anything until we've had a chance to discuss the merit of the proposal. |
|
Okay, I won't make any changes for now. |
|
I often use those number when comparing startup times so I prefer the consistency that the simple seconds figure gives. My vote is to leave things as they are. I also personally don't think the complexity of an additional property is worth the benefit. |
|
Perhaps ISO 8601 duration format could be considered here? That should be easier to grasp than the current format (PT14M48.643S vs 888.643 seconds), is more parser friendly, and obviously standards based. |
Currently, the startup time of Spring Boot applications is displayed in seconds, but this is not human-friendly for applications with exceptionally long startup times.
Times under 60 seconds continue to use decimal seconds (e.g., "3.456 seconds"), while longer durations are displayed in minutes and seconds (e.g., "1 minute 30 seconds") or hours and minutes (e.g., "1 hour 15 minutes"). This makes startup logs more accessible for applications with longer initialization times.