spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Consider showing more information in StartupInfoLogger

Open philwebb opened this issue 1 year ago • 4 comments

See #42324 for background.

Since StartupInfoLogger was first introduced we've added more features that could be useful to log. The application.name and application.version could be useful as could the git SHA if it's available.

We need to be a little careful not to add too much information and not to change the defaults in a way that folks won't like.

philwebb avatar Sep 16 '24 17:09 philwebb

We like the idea of at least logging the application name, if we can do it without adding too much noise.

philwebb avatar Sep 18 '24 15:09 philwebb

My two cents: I would vote for logging application version as well. It is very useful when receiving logs from client om-premise installations. Version extraction can be implemented in several ways (maybe with a configurable provider). We implemented extracting version from the JPMS module version, this seems to be a reasonable default.

One of the stackoverflow answers show how to add a module version using maven https://stackoverflow.com/questions/48151160/does-jpms-support-module-version

The official docs: https://docs.oracle.com/en/java/javase/17/docs/specs/man/jar.html (see --module-version)

And in app code the version can be retrieved like this

System.out.println("Hello, modular World!");
Module module = HelloModularWorld.class.getModule();
ModuleDescriptor descriptor = module.getDescriptor();
System.out.println(descriptor.rawVersion());

Dunemaster avatar Oct 09 '24 15:10 Dunemaster

@philwebb Hi Philip, I can create a PR for logging the application name and version. Could you please assign this issue to me?

sonu4578 avatar Oct 14 '24 05:10 sonu4578

Thanks for the offer, @sonu4578, but as indicated by the issue being labelled as "pending design work", we're not ready to accept contributions for this issue.

wilkinsona avatar Oct 14 '24 06:10 wilkinsona