diff --git a/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java b/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java
index 37651d4522f..c49fbc1ae4f 100644
--- a/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java
+++ b/application/src/main/java/org/opentripplanner/model/projectinfo/OtpProjectInfo.java
@@ -80,7 +80,7 @@ public String toString() {
* dev-2.x}
*/
public String getVersionString() {
- String format = "version: %s, ser.ver.id: %s, commit: %s, branch: %s";
+ String format = "Version: %s, ser.ver.id: %s, commit: %s, branch: %s";
return String.format(
format,
version.version,
@@ -91,8 +91,8 @@ public String getVersionString() {
}
/**
- * This method compare the maven project version, an return {@code true} if both are the same. Two
- * different SNAPSHOT versions are considered the same - work in progress.
+ * This method compares the maven project version, and return {@code true} if both are the same.
+ * Two different SNAPSHOT versions are considered the same version - they are work in progress.
*/
public boolean sameVersion(OtpProjectInfo other) {
return this.version.sameVersion(other.version);
@@ -100,8 +100,8 @@ public boolean sameVersion(OtpProjectInfo other) {
/**
* The OTP Serialization version id is used to determine if OTP and a serialized blob(Graph.obj)
- * of the otp internal model are compatible. This filed is writen into the Graph.obj file header
- * and checked when loading the graph later.
+ * of the otp internal model are compatible. This field is written into the Graph.obj
+ * file header and checked when loading the graph later.
*/
public String getOtpSerializationVersionId() {
return graphFileHeaderInfo.otpSerializationVersionId();
diff --git a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
index a8096d806ba..a10f8f8ef7b 100644
--- a/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
+++ b/application/src/main/java/org/opentripplanner/standalone/OTPMain.java
@@ -52,7 +52,7 @@ public static void main(String[] args) {
try {
Thread.currentThread().setName("main");
CommandLineParameters params = parseAndValidateCmdLine(args);
- OtpStartupInfo.logInfo();
+ OtpStartupInfo.logInfo(params.logTaskInfo());
startOTPServer(params);
} catch (OtpAppException ae) {
LOG.error(ae.getMessage(), ae);
diff --git a/application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java b/application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java
index c601846d889..ddcc2c60212 100644
--- a/application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java
+++ b/application/src/main/java/org/opentripplanner/standalone/OtpStartupInfo.java
@@ -34,13 +34,18 @@ private static String info() {
);
}
- public static void logInfo() {
+ public static void logInfo(String cliTaskInfo) {
// This is good when aggregating logs across multiple load balanced instances of OTP
// Hint: a regexp filter like "^OTP (START|SHUTTING)" will list nodes going up/down
- LOG.info("OTP STARTING UP ({}) using Java {}", projectInfo().getVersionString(), javaVersion());
+ LOG.info(
+ "OTP STARTING UP - {} - {} - Java {}",
+ cliTaskInfo,
+ projectInfo().getVersionString(),
+ javaVersion()
+ );
ApplicationShutdownSupport.addShutdownHook(
"server-shutdown-info",
- () -> LOG.info("OTP SHUTTING DOWN ({})", projectInfo().getVersionString())
+ () -> LOG.info("OTP SHUTTING DOWN - {} - {}", cliTaskInfo, projectInfo().getVersionString())
);
LOG.info(NEW_LINE + "{}", info());
}
diff --git a/application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java b/application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java
index 3513ec252ea..2324ce325d9 100644
--- a/application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java
+++ b/application/src/main/java/org/opentripplanner/standalone/config/CommandLineParameters.java
@@ -201,6 +201,21 @@ public boolean doServe() {
return load || (serve && doBuildTransit());
}
+ public String logTaskInfo() {
+ var mainCommands = new ArrayList();
+ if (doBuildStreet() & doBuildTransit()) {
+ mainCommands.add("Build Street & Transit Graph");
+ } else if (doBuildStreet()) {
+ mainCommands.add("Build Street Graph");
+ } else if (doBuildTransit()) {
+ mainCommands.add("Build Transit Graph");
+ }
+ if (doServe()) {
+ mainCommands.add("Run Server");
+ }
+ return String.join(", ", mainCommands);
+ }
+
/**
* @param port a port that we plan to bind to
* @throws ParameterException if that port is not available
diff --git a/application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java b/application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java
index 82c3589202c..0551d9e7056 100644
--- a/application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java
+++ b/application/src/test/java/org/opentripplanner/standalone/config/CommandLineParametersTest.java
@@ -41,6 +41,8 @@ public void everyThingOffByDefault() {
assertFalse(subject.doLoadStreetGraph());
assertFalse(subject.doSaveGraph());
assertFalse(subject.doServe());
+ var ex = assertThrows(ParameterException.class, () -> subject.inferAndValidate());
+ assertEquals("Nothing to do. Use --help to see available options.", ex.getMessage());
}
@Test
@@ -50,6 +52,7 @@ public void build() {
assertTrue(subject.doBuildTransit());
assertFalse(subject.doSaveGraph());
assertFalse(subject.doServe());
+ assertEquals("Build Street & Transit Graph", subject.logTaskInfo());
subject.save = true;
subject.serve = false;
@@ -58,6 +61,7 @@ public void build() {
assertTrue(subject.doSaveGraph());
assertFalse(subject.doServe());
subject.inferAndValidate();
+ assertEquals("Build Street & Transit Graph", subject.logTaskInfo());
subject.save = false;
subject.serve = true;
@@ -66,6 +70,7 @@ public void build() {
assertFalse(subject.doSaveGraph());
assertTrue(subject.doServe());
subject.inferAndValidate();
+ assertEquals("Build Street & Transit Graph, Run Server", subject.logTaskInfo());
subject.save = true;
subject.serve = true;
@@ -74,6 +79,7 @@ public void build() {
assertTrue(subject.doSaveGraph());
assertTrue(subject.doServe());
subject.inferAndValidate();
+ assertEquals("Build Street & Transit Graph, Run Server", subject.logTaskInfo());
}
@Test
@@ -83,6 +89,7 @@ public void buildStreet() {
assertFalse(subject.doBuildTransit());
assertTrue(subject.doSaveStreetGraph());
assertFalse(subject.doSaveGraph());
+ assertEquals("Build Street Graph", subject.logTaskInfo());
}
@Test
@@ -90,6 +97,7 @@ public void doLoadGraph() {
subject.load = true;
assertTrue(subject.doLoadGraph());
assertTrue(subject.doServe());
+ assertEquals("Run Server", subject.logTaskInfo());
}
@Test
@@ -99,6 +107,7 @@ public void doLoadStreetGraph() {
assertFalse(subject.doBuildStreet());
assertFalse(subject.doSaveStreetGraph());
assertFalse(subject.doSaveGraph());
+ assertEquals("Build Transit Graph", subject.logTaskInfo());
subject.save = true;
subject.serve = true;
@@ -119,6 +128,7 @@ public void validateLoad() {
// Implicit given, but should be ok to set
subject.serve = true;
+ assertEquals("Run Server", subject.logTaskInfo());
// No exception thrown
subject.inferAndValidate();
diff --git a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java
index f0e87b046c5..e5e305d8081 100644
--- a/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java
+++ b/application/src/test/java/org/opentripplanner/transit/speed_test/SpeedTest.java
@@ -144,7 +144,7 @@ public TestStatus status() {
public static void main(String[] args) {
try {
- OtpStartupInfo.logInfo();
+ OtpStartupInfo.logInfo("Run Speed Test");
// Given the following setup
SpeedTestCmdLineOpts opts = new SpeedTestCmdLineOpts(args);
var config = SpeedTestConfig.config(opts.rootDir());