From 189d1ed84eb3c05b88438217087eaa1f8b905674 Mon Sep 17 00:00:00 2001 From: "alan578.zhao" <956322745@qq.com> Date: Mon, 15 Jul 2024 11:44:36 +0800 Subject: [PATCH] close #2581 GRPC Java defaults to using java. til.logging (JUL) as the logging framework. In order to print logs using log4j2.xml configuration rules, the dependency Bridge from JUL to Log4j is used --- .../src/assembly/static/bin/start-hugegraph-pd.sh | 4 +++- .../hg-pd-dist/src/assembly/static/conf/log4j2.xml | 2 +- hugegraph-pd/hg-pd-service/pom.xml | 7 ++++++- .../src/assembly/static/bin/start-hugegraph-store.sh | 2 +- .../hg-store-dist/src/assembly/static/conf/log4j2.xml | 2 +- hugegraph-store/hg-store-node/pom.xml | 6 ++++++ 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh index 722b864db7..b75448b035 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh @@ -159,8 +159,10 @@ if [ $(ps -ef|grep -v grep| grep java|grep -cE ${CONF}) -ne 0 ]; then fi echo "Starting HugeGraphPDServer..." +JVM_OPTIONS="-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager" + # Turn on security check -exec ${JAVA} -Dname="HugeGraphPD" ${JAVA_OPTIONS} -jar \ +exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ -Dspring.config.location=${CONF}/application.yml ${LIB}/hg-pd-service-*.jar >> ${OUTPUT} 2>&1 & PID="$!" diff --git a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml index a804948703..61ed1ca4d7 100644 --- a/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml @@ -129,7 +129,7 @@ - + diff --git a/hugegraph-pd/hg-pd-service/pom.xml b/hugegraph-pd/hg-pd-service/pom.xml index 682daba85d..14fed89ee0 100644 --- a/hugegraph-pd/hg-pd-service/pom.xml +++ b/hugegraph-pd/hg-pd-service/pom.xml @@ -139,7 +139,12 @@ 2.7 compile - + + + org.apache.logging.log4j + log4j-jul + 2.17.2 + diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh index 991d42767a..b12fb354df 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh +++ b/hugegraph-store/hg-store-dist/src/assembly/static/bin/start-hugegraph-store.sh @@ -150,7 +150,7 @@ case "$GC_OPTION" in exit 1 esac -JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Dfastjson.parser.safeMode=true" +JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Dfastjson.parser.safeMode=true -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager" if [ "${OPEN_TELEMETRY}" == "true" ]; then OT_JAR="opentelemetry-javaagent.jar" diff --git a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml index 388d09e2fd..b09dc54d51 100644 --- a/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml +++ b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml @@ -131,7 +131,7 @@ - + diff --git a/hugegraph-store/hg-store-node/pom.xml b/hugegraph-store/hg-store-node/pom.xml index 90ba166ab8..cf0444584e 100644 --- a/hugegraph-store/hg-store-node/pom.xml +++ b/hugegraph-store/hg-store-node/pom.xml @@ -143,6 +143,12 @@ log4j-api 2.17.2 + + + org.apache.logging.log4j + log4j-jul + 2.17.2 +