From 21318be0f1eedd5fa06992344815afbf1c14cd56 Mon Sep 17 00:00:00 2001 From: Alexandre Boucey Date: Sun, 30 Jan 2022 14:48:44 +0100 Subject: [PATCH] Use Log4J2 JVM flag when file download fail --- scripts/start-finalExec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 3f28232568e..9cc2c7d007b 100755 --- a/scripts/start-finalExec +++ b/scripts/start-finalExec @@ -20,13 +20,15 @@ if [ -n "$ICON" ]; then fi canUseRollingLogs=true +useFallbackJvmFlag=false patchLog4jConfig() { file=${1?} url=${2?} if ! get -o "$file" "$url"; then - log "ERROR: failed to download corrected log4j config" - exit 1 + log "ERROR: failed to download corrected log4j config, fallback to JVM flag" + useFallbackJvmFlag=true + return 1 fi JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}" canUseRollingLogs=false @@ -46,6 +48,10 @@ elif isType PURPUR && versionLessThan 1.17; then elif isType PURPUR && versionLessThan 1.18.1; then patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml elif versionLessThan 1.18.1; then + useFallbackJvmFlag=true +fi + +if ${useFallbackJvmFlag}; then JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}" fi