Support json as a value of LOG_CONSOLE_FORMAT / LOG_FILE_FORMAT for JSON log lines (#4393)

This commit is contained in:
eliasehmann authored and GitHub committed 2026-11-14 10:29:12 -06:00
1 parent 58fa0ad96a
commit 30b26426f4
6 files changed
+73 -3

No files matched your search

@@ -0,0 +1,11 @@
services:
mc:
restart: "no"
image: ${IMAGE_TO_TEST:-itzg/minecraft-server}
environment:
EULA: "TRUE"
SETUP_ONLY: "TRUE"
GENERATE_LOG4J2_CONFIG: "true"
LOG_CONSOLE_FORMAT: json
volumes:
- ./data:/data
@@ -0,0 +1,5 @@
mc-image-helper assert fileExists /data/log4j2.xml
# console appender uses the JSON pattern
grep -A1 '<Console name="SysOut"' /data/log4j2.xml | grep -q '&quot;ecs.version&quot;'
# file appender keeps the default text pattern
grep -A1 '<RollingRandomAccessFile name="File"' /data/log4j2.xml | grep -qF 'pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n"'