Skip to content

if the log dir does not exist, create it first to avoid copy failue #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions vjstar/src/main/script/jvm-options/jvm-options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ GC_OPTS="$GC_OPTS -XX:+UnlockDiagnosticVMOptions -XX:ParGCCardsPerStrideChunk=10

# 默认使用/dev/shm 内存文件系统避免在高IO场景下写GC日志时被阻塞导致STW时间延长
if [ -d /dev/shm/ ]; then
GC_LOG_FILE=/dev/shm/gc-${APPID}.log
GC_LOG_FILE=/dev/shm/gc-${APPID}.log
else
GC_LOG_FILE=${LOGDIR}/gc-${APPID}.log
GC_LOG_FILE=${LOGDIR}/gc-${APPID}.log
fi


if [ -f ${GC_LOG_FILE} ]; then
[ ! -d ${LOGDIR} ] && mkdir -p ${LOGDIR}

GC_LOG_BACKUP=${LOGDIR}/gc-${APPID}-$(date +'%Y%m%d_%H%M%S').log
echo "saving gc log ${GC_LOG_FILE} to ${GC_LOG_BACKUP}"
mv ${GC_LOG_FILE} ${GC_LOG_BACKUP}
Expand All @@ -94,7 +96,7 @@ GCLOG_OPTS="-Xloggc:${GC_LOG_FILE} -XX:+PrintGCDetails -XX:+PrintGCDateStamps -X

#打印GC原因,JDK8默认打开
if [[ "$JAVA_VERSION" < "1.8" ]]; then
GCLOG_OPTS="$GCLOG_OPTS -XX:+PrintGCCause"
GCLOG_OPTS="$GCLOG_OPTS -XX:+PrintGCCause"
fi


Expand Down