Update started log message as app may not be running on a JVM

Closes gh-30974
pull/30984/head
Andy Wilkinson 3 years ago
parent c7590277a9
commit 2744649892

@ -26,7 +26,7 @@ When your application starts, you should see something similar to the following
2021-02-03 10:33:26.097 INFO 17900 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 821 ms 2021-02-03 10:33:26.097 INFO 17900 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 821 ms
2021-02-03 10:33:26.144 INFO 17900 --- [ main] s.tomcat.SampleTomcatApplication : ServletContext initialized 2021-02-03 10:33:26.144 INFO 17900 --- [ main] s.tomcat.SampleTomcatApplication : ServletContext initialized
2021-02-03 10:33:26.376 INFO 17900 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-02-03 10:33:26.376 INFO 17900 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2021-02-03 10:33:26.384 INFO 17900 --- [ main] o.s.b.d.s.s.SpringApplicationExample : Started SampleTomcatApplication in 1.514 seconds (JVM running for 1.823) 2021-02-03 10:33:26.384 INFO 17900 --- [ main] o.s.b.d.s.s.SpringApplicationExample : Started SampleTomcatApplication in 1.514 seconds (process running for 1.823)
---- ----

@ -207,7 +207,7 @@ You should see output similar to the following:
....... . . . ....... . . .
....... . . . (log output here) ....... . . . (log output here)
....... . . . ....... . . .
........ Started MyApplication in 2.222 seconds (JVM running for 6.514) ........ Started MyApplication in 2.222 seconds (process running for 6.514)
---- ----
If you open a web browser to `http://localhost:8080`, you should see the following output: If you open a web browser to `http://localhost:8080`, you should see the following output:
@ -307,7 +307,7 @@ To run that application, use the `java -jar` command, as follows:
....... . . . ....... . . .
....... . . . (log output here) ....... . . . (log output here)
....... . . . ....... . . .
........ Started MyApplication in 2.536 seconds (JVM running for 2.864) ........ Started MyApplication in 2.536 seconds (process running for 2.864)
---- ----
As before, to exit the application, press `ctrl-c`. As before, to exit the application, press `ctrl-c`.

@ -402,7 +402,7 @@ A running remote client might resemble the following listing:
2015-06-10 18:25:06.671 INFO 14938 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2a17b7b6: startup date [Wed Jun 10 18:25:06 PDT 2015]; root of context hierarchy 2015-06-10 18:25:06.671 INFO 14938 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2a17b7b6: startup date [Wed Jun 10 18:25:06 PDT 2015]; root of context hierarchy
2015-06-10 18:25:07.043 WARN 14938 --- [ main] o.s.b.d.r.c.RemoteClientConfiguration : The connection to http://localhost:8080 is insecure. You should use a URL starting with 'https://'. 2015-06-10 18:25:07.043 WARN 14938 --- [ main] o.s.b.d.r.c.RemoteClientConfiguration : The connection to http://localhost:8080 is insecure. You should use a URL starting with 'https://'.
2015-06-10 18:25:07.074 INFO 14938 --- [ main] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2015-06-10 18:25:07.074 INFO 14938 --- [ main] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2015-06-10 18:25:07.130 INFO 14938 --- [ main] o.s.b.devtools.RemoteSpringApplication : Started RemoteSpringApplication in 0.74 seconds (JVM running for 1.105) 2015-06-10 18:25:07.130 INFO 14938 --- [ main] o.s.b.devtools.RemoteSpringApplication : Started RemoteSpringApplication in 0.74 seconds (process running for 1.105)
---- ----
NOTE: Because the remote client is using the same classpath as the real application it can directly read application properties. NOTE: Because the remote client is using the same classpath as the real application it can directly read application properties.

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -92,7 +92,7 @@ class StartupInfoLogger {
message.append(" seconds"); message.append(" seconds");
try { try {
double uptime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000.0; double uptime = ManagementFactory.getRuntimeMXBean().getUptime() / 1000.0;
message.append(" (JVM running for ").append(uptime).append(")"); message.append(" (process running for ").append(uptime).append(")");
} }
catch (Throwable ex) { catch (Throwable ex) {
// No JVM time available // No JVM time available

@ -61,7 +61,7 @@ class StartupInfoLoggerTests {
ArgumentCaptor<Object> captor = ArgumentCaptor.forClass(Object.class); ArgumentCaptor<Object> captor = ArgumentCaptor.forClass(Object.class);
then(this.log).should().info(captor.capture()); then(this.log).should().info(captor.capture());
assertThat(captor.getValue().toString()).matches("Started " + getClass().getSimpleName() assertThat(captor.getValue().toString()).matches("Started " + getClass().getSimpleName()
+ " in \\d+\\.\\d{1,3} seconds \\(JVM running for \\d+\\.\\d{1,3}\\)"); + " in \\d+\\.\\d{1,3} seconds \\(process running for \\d+\\.\\d{1,3}\\)");
} }
} }

Loading…
Cancel
Save