From fadbee0812ac2d5921f1b00537f450c02d9eeb9f Mon Sep 17 00:00:00 2001 From: imuge Date: Thu, 31 Dec 2020 17:16:52 +0800 Subject: [PATCH 1/2] update log configurations --- .../src/main/resources/config/log4j2-peer.xml | 27 +++++++++++++++++++ .../src/main/resources/scripts/ledger-init.sh | 2 +- .../main/resources/scripts/peer-startup.sh | 7 ++--- 3 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 deploy/deploy-peer/src/main/resources/config/log4j2-peer.xml diff --git a/deploy/deploy-peer/src/main/resources/config/log4j2-peer.xml b/deploy/deploy-peer/src/main/resources/config/log4j2-peer.xml new file mode 100644 index 00000000..2d136e0b --- /dev/null +++ b/deploy/deploy-peer/src/main/resources/config/log4j2-peer.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh b/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh index eebc689b..ecbc3e02 100644 --- a/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh +++ b/deploy/deploy-peer/src/main/resources/scripts/ledger-init.sh @@ -5,5 +5,5 @@ boot_file=$(ls $HOME/libs | grep tools-initializer-booter-) if [ ! -n "$boot_file" ]; then echo "tools-initializer-booter is null" else - java -jar -server -Djdchain.log=$HOME $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $* + java -jar -server -Djdchain.log=$HOME/logs $HOME/libs/$boot_file -l $HOME/config/init/local.conf -i $HOME/config/init/ledger.init $* fi \ No newline at end of file diff --git a/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh b/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh index 9cb6597f..1823ad19 100644 --- a/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh +++ b/deploy/deploy-peer/src/main/resources/scripts/peer-startup.sh @@ -30,9 +30,6 @@ APP_HOME=$(cd `dirname $0`;cd ../; pwd) #System目录 APP_SYSTEM_PATH=$APP_HOME/system -#节点输出日志路径 -LOG_OUT=$APP_HOME/bin/peer.out - #获取Peer节点的启动Jar包 APP_JAR=$(ls $APP_SYSTEM_PATH | grep $APP_JAR_PREFIX) @@ -43,7 +40,7 @@ CONFIG_PATH=$APP_HOME/config LEDGER_BINDING_CONFIG=$CONFIG_PATH/ledger-binding.conf #定义程序启动的参数 -JAVA_OPTS="-jar -server -Xms2048m -Xmx2048m" +JAVA_OPTS="-jar -server -Xms2048m -Xmx2048m -Djdchain.log=$APP_HOME/logs -Dlogging.config=file:$APP_HOME/config/log4j2-peer.xml" #APP具体相关命令 APP_CMD=$APP_SYSTEM_PATH/$APP_JAR" -home="$APP_HOME" -c "$LEDGER_BINDING_CONFIG" -p "$WEB_PORT @@ -104,7 +101,7 @@ if [[ $psid -ne 0 ]]; then echo "================================" else echo "Starting Peer ......" - nohup $JAVA_BIN $JAVA_OPTS $APP_CMD $* >$LOG_OUT 2>&1 & + nohup $JAVA_BIN $JAVA_OPTS $APP_CMD $* & JAVA_CMD="$JAVA_BIN $JAVA_OPTS $APP_CMD $*" sleep 1 checkpid From 83da1bb654cb46cbc3ac1464b6617eec82cae0e0 Mon Sep 17 00:00:00 2001 From: imuge Date: Thu, 31 Dec 2020 18:11:33 +0800 Subject: [PATCH 2/2] update gateway log configuration --- .../src/main/resources/config/log4j2-gw.xml | 27 +++++++++++++++++++ .../src/main/resources/scripts/startup.sh | 6 ++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 deploy/deploy-gateway/src/main/resources/config/log4j2-gw.xml diff --git a/deploy/deploy-gateway/src/main/resources/config/log4j2-gw.xml b/deploy/deploy-gateway/src/main/resources/config/log4j2-gw.xml new file mode 100644 index 00000000..8bffe83a --- /dev/null +++ b/deploy/deploy-gateway/src/main/resources/config/log4j2-gw.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/deploy/deploy-gateway/src/main/resources/scripts/startup.sh b/deploy/deploy-gateway/src/main/resources/scripts/startup.sh index 76189f54..2db26ec4 100644 --- a/deploy/deploy-gateway/src/main/resources/scripts/startup.sh +++ b/deploy/deploy-gateway/src/main/resources/scripts/startup.sh @@ -20,7 +20,7 @@ APP_HOME=$(cd `dirname $0`;cd ../; pwd) APP_LIB_PATH=$APP_HOME/lib #节点输出日志路径 -LOG_OUT=$APP_HOME/bin/gw.out +LOG_OUT=$APP_HOME/logs #获取Peer节点的启动Jar包 APP_JAR=$(ls $APP_LIB_PATH | grep $APP_JAR_PREFIX) @@ -32,7 +32,7 @@ CONFIG_PATH=$APP_HOME/config GATEWAY_CONFIG=$CONFIG_PATH/gateway.conf #定义程序启动的参数 -JAVA_OPTS="-jar -server -Xms1024m -Xmx1024m" +JAVA_OPTS="-jar -server -Xms1024m -Xmx1024m -Djdchain.log=$LOG_OUT -Dlogging.config=file:$APP_HOME/config/log4j2-gw.xml" #APP具体相关命令 APP_CMD=$APP_LIB_PATH/$APP_JAR" -c "$GATEWAY_CONFIG @@ -90,7 +90,7 @@ if [[ $psid -ne 0 ]]; then echo "================================" else echo "Starting Gateway ......" - nohup $JAVA_BIN $JAVA_OPTS $APP_CMD $* >$LOG_OUT 2>&1 & + nohup $JAVA_BIN $JAVA_OPTS $APP_CMD $* & JAVA_CMD="$JAVA_BIN $JAVA_OPTS $APP_CMD $*" sleep 1 checkpid