Spring-boot: Include link to running web application in startup log output

Created on 18 Mar 2019  路  4Comments  路  Source: spring-projects/spring-boot

When starting a Spring Boot web application from the local command line, one sees log output similar to the following once the application has successfully started.

Tomcat started on port(s): 8080 (http) with context path ''
Started Application in 4.251 seconds (JVM running for 4.721)

It would be very convenient if Spring Boot emitted an additional log statement (or amended one of the previous two) to print something like the following, where the <scheme>, <port>, and <context path> would be substituted with the appropriate values.

Web Application available on localhost via <scheme>://localhost:<port>/<context path>

Rationale: in many terminals it is possible to click directly on that link, and when that's not supported it's still easy to copy the link and paste it into a browser.

enhancement

Most helpful comment

I can鈥檛 recall what came to mind at the time, but off the top of my head, there are a few things to consider:

  1. Consistent output across Jetty, Netty, Tomcat, and Undertow. Should we try and use shared code?
  2. Servlet stack has a context path, reactive stack does not, and Jetty, Tomcat, and Undertow support both stacks.
  3. Is localhost the right host to use? It makes the feature useless when viewing remote logs.

All 4 comments

Can I work on this one if accepted by team?

@pkostrzewa Thanks for the offer. I think we'll need to do a bit of design work before anyone could work on this one.

I don't want to demand too much, but, @wilkinsona , can you at least briefly explain, what design work does this feature require? It seems to me very easy to implement, so obviously I am missing something here and very curious to learn.

I can鈥檛 recall what came to mind at the time, but off the top of my head, there are a few things to consider:

  1. Consistent output across Jetty, Netty, Tomcat, and Undertow. Should we try and use shared code?
  2. Servlet stack has a context path, reactive stack does not, and Jetty, Tomcat, and Undertow support both stacks.
  3. Is localhost the right host to use? It makes the feature useless when viewing remote logs.
Was this page helpful?
0 / 5 - 0 ratings