From e503f73117fd2e72eab0f0b600b982a465088d96 Mon Sep 17 00:00:00 2001 From: Bill Decoste Date: Mon, 24 Jul 2017 12:33:01 -0700 Subject: [PATCH] CLOUD-1817 better logging for multiple jars --- os-java-run/added/run-java.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/os-java-run/added/run-java.sh b/os-java-run/added/run-java.sh index fb3627c2..b624e4e3 100644 --- a/os-java-run/added/run-java.sh +++ b/os-java-run/added/run-java.sh @@ -3,6 +3,11 @@ # Fail on a single failed command set -eo pipefail +if [ "${SCRIPT_DEBUG}" = "true" ] ; then + set -x + echo "Script debugging is enabled, allowing bash commands and their arguments to be printed as they are executed" +fi + # ========================================================== # Generic run script for running arbitrary Java applications # @@ -41,10 +46,11 @@ auto_detect_jar_file() { ls *.jar | grep -v '^original-' exit 0 fi + + echo >&2 "ERROR: Neither \$JAVA_MAIN_CLASS nor \$JAVA_APP_JAR is set and ${nr_jars} JARs found in ${dir} (1 expected)" cd ${old_dir} - echo "ERROR: Neither \$JAVA_MAIN_CLASS nor \$JAVA_APP_JAR is set and ${nr_jars} found in ${dir} (1 expected)" else - echo "ERROR: No directory ${dir} found for auto detection" + echo >&2 "ERROR: No directory ${dir} found for auto detection" fi } @@ -57,7 +63,7 @@ get_jar_file() { if [ -f "${jar}" ]; then echo "${jar}" else - echo "ERROR: No such file ${jar}" + echo >&2 "ERROR: No such file ${jar}" fi else for dir in $*; do @@ -66,7 +72,7 @@ get_jar_file() { return fi done - echo "ERROR: No ${jar} found in $*" + echo >&2 "ERROR: No ${jar} found in $*" fi }