mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-05-23 04:05:26 +00:00
Use Log4J2 JVM flag when file download fail (#1316)
This commit is contained in:
@@ -20,13 +20,15 @@ if [ -n "$ICON" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
canUseRollingLogs=true
|
canUseRollingLogs=true
|
||||||
|
useFallbackJvmFlag=false
|
||||||
|
|
||||||
patchLog4jConfig() {
|
patchLog4jConfig() {
|
||||||
file=${1?}
|
file=${1?}
|
||||||
url=${2?}
|
url=${2?}
|
||||||
if ! get -o "$file" "$url"; then
|
if ! get -o "$file" "$url"; then
|
||||||
log "ERROR: failed to download corrected log4j config"
|
log "ERROR: failed to download corrected log4j config, fallback to JVM flag"
|
||||||
exit 1
|
useFallbackJvmFlag=true
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j.configurationFile=${file} ${JVM_OPTS}"
|
||||||
canUseRollingLogs=false
|
canUseRollingLogs=false
|
||||||
@@ -46,6 +48,10 @@ elif isType PURPUR && versionLessThan 1.17; then
|
|||||||
elif isType PURPUR && versionLessThan 1.18.1; then
|
elif isType PURPUR && versionLessThan 1.18.1; then
|
||||||
patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml
|
patchLog4jConfig purpur_log4j2_117.xml https://purpurmc.org/docs/xml/purpur_log4j2_117.xml
|
||||||
elif versionLessThan 1.18.1; then
|
elif versionLessThan 1.18.1; then
|
||||||
|
useFallbackJvmFlag=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ${useFallbackJvmFlag}; then
|
||||||
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
JVM_OPTS="-Dlog4j2.formatMsgNoLookups=true ${JVM_OPTS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user