diff --git a/README.md b/README.md index bdf77d1a..91d17cd2 100644 --- a/README.md +++ b/README.md @@ -1559,6 +1559,20 @@ To enable the JVM flags required to fully support the [Flare profiling suite](ht Flare is built-in to Airplane/Pufferfish/Purpur, and is available in [plugin form](https://github.com/TECHNOVE/FlarePlugin) for other server types. +### Enable timestamps in init logs + +Before the container starts the Minecraft Server its output is prefixed with `[init]`, such as + +``` +[init] Starting the Minecraft server... +``` + +To also include the timestamp with each log, set `LOG_TIMESTAMP` to "true". The log output will then look like: + +``` +[init] 2022-02-05 16:58:33+00:00 Starting the Minecraft server... +``` + ## Autopause ### Description diff --git a/scripts/start-utils b/scripts/start-utils index 376e52b8..d56d41f2 100755 --- a/scripts/start-utils +++ b/scripts/start-utils @@ -40,6 +40,10 @@ function getFilenameFromUrl() { } function isTrue() { + local oldState + oldState=$(shopt -po xtrace) + shopt -u -o xtrace + local value=${1,,} result= @@ -53,6 +57,7 @@ function isTrue() { ;; esac + eval "$oldState" return ${result} } @@ -82,7 +87,18 @@ function logn() { } function log() { - echo "[init] $*" + local oldState + # The return status when listing options is zero if all optnames are enabled, non- zero otherwise. + oldState=$(shopt -po xtrace || true) + shopt -u -o xtrace + + if isDebugging || isTrue "${LOG_TIMESTAMP:-false}"; then + ts=" $(date --rfc-3339=seconds)" + else + ts= + fi + echo "[init]${ts} $*" + eval "$oldState" } function logAutopause() { diff --git a/tests/setuponlytests/forgeapimods_file/docker-compose.yml b/tests/setuponlytests/forgeapimods_file/docker-compose.disabled.yml similarity index 100% rename from tests/setuponlytests/forgeapimods_file/docker-compose.yml rename to tests/setuponlytests/forgeapimods_file/docker-compose.disabled.yml diff --git a/tests/setuponlytests/forgeapimods_projectids/docker-compose.yml b/tests/setuponlytests/forgeapimods_projectids/docker-compose.disabled.yml similarity index 100% rename from tests/setuponlytests/forgeapimods_projectids/docker-compose.yml rename to tests/setuponlytests/forgeapimods_projectids/docker-compose.disabled.yml