You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by zh...@apache.org on 2022/05/20 06:16:26 UTC
[pulsar] branch master updated: [fix][env]Fix wrongly set jvm gc log dir (#15449)
This is an automated email from the ASF dual-hosted git repository.
zhangmingao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new f3c072e0d22 [fix][env]Fix wrongly set jvm gc log dir (#15449)
f3c072e0d22 is described below
commit f3c072e0d22da40c859a8424823a10c062635b76
Author: gaozhangmin <ga...@qq.com>
AuthorDate: Fri May 20 14:16:17 2022 +0800
[fix][env]Fix wrongly set jvm gc log dir (#15449)
* Fix error set jvm gc log dir
* fix unit test
Co-authored-by: gavingaozhangmin <ga...@didiglobal.com>
---
bin/pulsar | 2 +-
bin/pulsar-daemon | 7 ++++---
conf/bkenv.sh | 5 +++--
conf/pulsar_env.sh | 5 +++--
4 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/bin/pulsar b/bin/pulsar
index f19d818cd2e..78749334d94 100755
--- a/bin/pulsar
+++ b/bin/pulsar
@@ -52,7 +52,7 @@ then
fi
# Check pulsar env and load pulsar_env.sh
-if [ -f "$PULSAR_HOME/conf/pulsar_env.sh" ]
+if [[ -f "$PULSAR_HOME/conf/pulsar_env.sh" && $1 != "bookie" ]]
then
. "$PULSAR_HOME/conf/pulsar_env.sh"
fi
diff --git a/bin/pulsar-daemon b/bin/pulsar-daemon
index 16e72b66d70..66d0a607d33 100755
--- a/bin/pulsar-daemon
+++ b/bin/pulsar-daemon
@@ -73,12 +73,15 @@ shift
if [[ "$command" = "bookie" ]]
then
PULSAR_LOG_DIR=${BOOKIE_LOG_DIR:-"$PULSAR_HOME/logs"}
+ PULSAR_PID_DIR=${BOOKIE_PID_DIR:-"$PULSAR_HOME/bin"}
else
PULSAR_LOG_DIR=${PULSAR_LOG_DIR:-"$PULSAR_HOME/logs"}
+ PULSAR_PID_DIR=${PULSAR_PID_DIR:-"$PULSAR_HOME/bin"}
fi
PULSAR_LOG_APPENDER=${PULSAR_LOG_APPENDER:-"RollingFile"}
PULSAR_STOP_TIMEOUT=${PULSAR_STOP_TIMEOUT:-30}
-PULSAR_PID_DIR=${PULSAR_PID_DIR:-$PULSAR_HOME/bin}
+mkdir -p "$PULSAR_LOG_DIR"
+mkdir -p "$PULSAR_PID_DIR"
case $command in
(broker)
@@ -213,8 +216,6 @@ stop ()
fi
}
-mkdir -p "$PULSAR_LOG_DIR"
-
case $startStop in
(start)
start "$*"
diff --git a/conf/bkenv.sh b/conf/bkenv.sh
index b771b90cd09..7ec75485bdf 100644
--- a/conf/bkenv.sh
+++ b/conf/bkenv.sh
@@ -47,12 +47,13 @@ else
IS_JAVA_8=`$JAVA_HOME/bin/java -version 2>&1 |grep version|grep '"1\.8'`
fi
+BOOKIE_GC_LOG_DIR=${BOOKIE_LOG_DIR:-"logs"}
# java version has space, use [[ -n $PARAM ]] to judge if variable exists
if [[ -n $IS_JAVA_8 ]]; then
- BOOKIE_GC_LOG=${BOOKIE_GC_LOG:-${PULSAR_GC_LOG:-"-Xloggc:logs/pulsar_bookie_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}}
+ BOOKIE_GC_LOG=${BOOKIE_GC_LOG:-${PULSAR_GC_LOG:-"-Xloggc:$BOOKIE_GC_LOG_DIR/pulsar_bookie_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}}
else
# After jdk 9, gc log param should config like this. Ignoring version less than jdk 8
- BOOKIE_GC_LOG=${BOOKIE_GC_LOG:-${PULSAR_GC_LOG:-"-Xlog:gc*:logs/pulsar_bookie_gc_%p.log:time,uptime,level,tags:filecount=10,filesize=20M"}}
+ BOOKIE_GC_LOG=${BOOKIE_GC_LOG:-${PULSAR_GC_LOG:-"-Xlog:gc*:$BOOKIE_GC_LOG_DIR/pulsar_bookie_gc_%p.log:time,uptime,level,tags:filecount=10,filesize=20M"}}
fi
# Extra options to be passed to the jvm
diff --git a/conf/pulsar_env.sh b/conf/pulsar_env.sh
index 8a72d2a4084..74fa6fbc801 100755
--- a/conf/pulsar_env.sh
+++ b/conf/pulsar_env.sh
@@ -55,11 +55,12 @@ else
IS_JAVA_8=`$JAVA_HOME/bin/java -version 2>&1 |grep version|grep '"1\.8'`
fi
# java version has space, use [[ -n $PARAM ]] to judge if variable exists
+PULSAR_GC_LOG_DIR=${PULSAR_LOG_DIR:-"logs"}
if [[ -n $IS_JAVA_8 ]]; then
- PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xloggc:logs/pulsar_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}
+ PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xloggc:$PULSAR_GC_LOG_DIR/pulsar_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}
else
# After jdk 9, gc log param should config like this. Ignoring version less than jdk 8
- PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xlog:gc*:logs/pulsar_gc_%p.log:time,uptime:filecount=10,filesize=20M"}
+ PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xlog:gc*:$PULSAR_GC_LOG_DIR/pulsar_gc_%p.log:time,uptime:filecount=10,filesize=20M"}
fi
# Extra options to be passed to the jvm