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 1/4] 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 + From 759bab6ccdc0e5073df637cb5f2732cc01f6cda7 Mon Sep 17 00:00:00 2001 From: "alan578.zhao" <956322745@qq.com> Date: Thu, 18 Jul 2024 10:26:19 +0800 Subject: [PATCH 2/4] close #2583 --- hugegraph-pd/hg-pd-dist/src/assembly/static/conf/log4j2.xml | 2 +- .../hg-store-dist/src/assembly/static/conf/log4j2.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 61ed1ca4d7..a804948703 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-store/hg-store-dist/src/assembly/static/conf/log4j2.xml b/hugegraph-store/hg-store-dist/src/assembly/static/conf/log4j2.xml index b09dc54d51..388d09e2fd 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 @@ - + From 63bd7abe7323b759a29ced31bbf94410b87be286 Mon Sep 17 00:00:00 2001 From: "alan578.zhao" <956322745@qq.com> Date: Thu, 18 Jul 2024 13:47:00 +0800 Subject: [PATCH 3/4] close #2583 --- .../hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 b75448b035..b013691bf4 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,7 +159,8 @@ 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" +JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Djava.util.logging.manager=org.apache +.logging.log4j.jul.LogManager" # Turn on security check exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \ From 623ce539e1ab52b7d52fc43dcefa73778eac28dc Mon Sep 17 00:00:00 2001 From: VGalaxies Date: Tue, 23 Jul 2024 22:20:38 +0800 Subject: [PATCH 4/4] fix JVM_OPTIONS --- .../hg-pd-dist/src/assembly/static/bin/start-hugegraph-pd.sh | 3 +-- 1 file changed, 1 insertion(+), 2 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 b013691bf4..151465ec6d 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,7 @@ if [ $(ps -ef|grep -v grep| grep java|grep -cE ${CONF}) -ne 0 ]; then fi echo "Starting HugeGraphPDServer..." -JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Djava.util.logging.manager=org.apache -.logging.log4j.jul.LogManager" +JVM_OPTIONS="-Dlog4j.configurationFile=${CONF}/log4j2.xml -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager" # Turn on security check exec ${JAVA} -Dname="HugeGraphPD" ${JVM_OPTIONS} ${JAVA_OPTIONS} -jar \