From 240238013bbddd3044f4d835d64d669ba3bf0ded Mon Sep 17 00:00:00 2001 From: Alexandre Boucey Date: Sun, 30 Jan 2022 20:46:09 +0100 Subject: [PATCH] Use Log4J2 JVM flag when file download fail (#1316) --- scripts/start-finalExec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/start-finalExec b/scripts/start-finalExec index 3f282325..9cc2c7d0 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