Skip to content

Commit

Permalink
move gc log to a logs subdirectory.
Browse files Browse the repository at this point in the history
RB_ID=93786
  • Loading branch information
Cory Watson committed Oct 26, 2012
1 parent bfb8217 commit 431c29e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/scripts/foreground.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ FD_LIMIT="262144"
HEAP_OPTS="-Xmx16G -XX:NewSize=2G"
GC_OPTS="-XX:+UseParallelOldGC -XX:+UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=1000 -XX:GCTimeRatio=99 -XX:NewSize=2G"
GC_TRACE="-verbosegc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps"
GC_LOG="-Xloggc:gc.log"
GC_LOG="-Xloggc:logs/gc.log"
DEBUG_OPTS="-XX:ErrorFile=java_error%p.log"

# allow a separate file to override settings.
test -f /etc/sysconfig/kestrel && . /etc/sysconfig/kestrel

JAVA_OPTS="-server $GC_OPTS $GC_TRACE $GC_LOG $HEAP_OPTS $DEBUG_OPTS"

pidfile="$APP_NAME.pid"

find_java() {
if [ ! -z "$JAVA_HOME" ]; then
return
Expand All @@ -42,6 +44,8 @@ find_java() {

find_java

mkdir logs

echo "Starting $APP_NAME... "

if [ ! -r $APP_HOME/$JAR_NAME ]; then
Expand All @@ -59,11 +63,12 @@ TIMESTAMP=$(date +%Y%m%d%H%M%S);
# Move the existing gc log to a timestamped file in case we want to examine it.
# We must do this here because we have no option to append this via the JVM's
# command line args.
if [ -f gc.log ]; then
mv gc.log gc_$TIMESTAMP.log;
if [ -f logs/gc.log ]; then
mv logs/gc.log logs/gc_$TIMESTAMP.log;
fi

ulimit -n $FD_LIMIT || echo " (no ulimit)"
ulimit -c unlimited || echo " (no coredump)"

${JAVA_HOME}/bin/java ${JAVA_OPTS} -jar ${APP_HOME}/${JAR_NAME} "$@" >> stdout 2>> error
echo "'$$'" > $pidfile
exec ${JAVA_HOME}/bin/java ${JAVA_OPTS} -jar ${APP_HOME}/${JAR_NAME} "$@" >> stdout 2>> error

0 comments on commit 431c29e

Please sign in to comment.