diff --git a/Dockerfile b/Dockerfile index 46629dc3..0c5f682a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,6 +60,7 @@ COPY mcstatus /usr/local/bin VOLUME ["/data","/mods","/config"] COPY server.properties /tmp/server.properties +COPY log4j2.xml /tmp/log4j2.xml WORKDIR /data ENTRYPOINT [ "/start" ] diff --git a/log4j2.xml b/log4j2.xml new file mode 100644 index 00000000..ca9f73d2 --- /dev/null +++ b/log4j2.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/start-minecraftFinalSetup b/start-minecraftFinalSetup index df5a6909..e9920f11 100644 --- a/start-minecraftFinalSetup +++ b/start-minecraftFinalSetup @@ -27,6 +27,16 @@ if [ -n "$ICON" -a ! -e server-icon.png ]; then fi fi +# Set up log configuration +LOGFILE="/data/log4j2.xml" +if [ ! -e "$LOGFILE" ]; then + log "Creating log4j2.xml in ${LOGFILE}" + cp /tmp/log4j2.xml "$LOGFILE" +else + log "log4j2.xml already created, skipping" +fi +JVM_OPTS="-Dlog4j.configurationFile=/data/log4j2.xml ${JVM_OPTS}" + # Make sure files exist and are valid JSON (for pre-1.12 to 1.12 upgrades) log "Checking for JSON files." JSON_FILES=$(find . -maxdepth 1 -name '*.json')