Skip to content

Commit 95d3b22

Browse files
committed
vipshop#170 provide command-line options for custom log output paths
1 parent 52b7c4c commit 95d3b22

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

saturn-executor/src/main/assembly/bin/saturn-executor.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ USAGE()
3939
echo -e "\n '-r|--runmode': optional, default value is $RUN_MODE, you can set it foreground"
4040
echo -e "\n '-jmx|--jmx-port': optional, default value is ${JMX_PORT}."
4141
echo -e "\n '-env|--environment': optional."
42+
echo -e "\n '-sdl|--saturnLogDir': optional."
4243
echo -e "\n JVM args: optional."
4344
}
4445

@@ -58,6 +59,7 @@ while true; do
5859
-r| --runmode) RUN_MODE="$2"; shift 2;;
5960
-jmx|--jmx-port) JMX_PORT="$2" ; shift 2 ;;
6061
-env|--environment) RUN_ENVIRONMENT="$2" ; shift 2 ;;
62+
-sdl|--saturnLogDir) LOGDIR="$2" ; shift 2 ;;
6163
*) break;;
6264
esac
6365
done
@@ -79,11 +81,13 @@ else
7981
ENVIRONMENT_MEM="-Xms2048m -Xmx2048m"
8082
fi
8183

84+
if [[ "$LOGDIR" = "" ]]; then
85+
LOGDIR=/apps/logs/saturn/${NAMESPACE}/${EXECUTORNAME}-${LOCALIP}
86+
fi
8287

83-
LOGDIR=/apps/logs/saturn/${NAMESPACE}/${EXECUTORNAME}-${LOCALIP}
8488
OUTFILE=$LOGDIR/saturn-executor.log
8589

86-
JAVA_OPTS="-Dsaturn.log=${LOGDIR} -XX:+PrintCommandLineFlags -XX:-OmitStackTraceInFastThrow -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000"
90+
JAVA_OPTS="-Dsaturn.log=${LOGDIR} -DSATURN_LOG_DIR=${LOGDIR} -XX:+PrintCommandLineFlags -XX:-OmitStackTraceInFastThrow -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000"
8791
MEM_OPTS="-server ${ENVIRONMENT_MEM} -XX:NewRatio=1 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxTenuringThreshold=6 -XX:+ExplicitGCInvokesConcurrent"
8892
GCLOG_OPTS="-Xloggc:${LOGDIR}/gc.log -XX:+PrintGCApplicationStoppedTime -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCDateStamps -XX:+PrintGCDetails"
8993
CRASH_OPTS="-XX:ErrorFile=${LOGDIR}/hs_err_%p.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGDIR}/"

0 commit comments

Comments
 (0)