You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by cr...@apache.org on 2014/06/12 01:12:42 UTC

git commit: SAMZA-20; roll gc logs if jvm supports it

Repository: incubator-samza
Updated Branches:
  refs/heads/master 11566ab7a -> bb82797e9


SAMZA-20; roll gc logs if jvm supports it


Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/bb82797e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/bb82797e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/bb82797e

Branch: refs/heads/master
Commit: bb82797e9e1e8eb26a07d873f0ffbd6b23c51451
Parents: 11566ab
Author: Raul Castro Fernandez <ra...@contxt.in>
Authored: Wed Jun 11 16:12:29 2014 -0700
Committer: Chris Riccomini <cr...@criccomi-mn.linkedin.biz>
Committed: Wed Jun 11 16:12:29 2014 -0700

----------------------------------------------------------------------
 samza-shell/src/main/bash/run-class.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/bb82797e/samza-shell/src/main/bash/run-class.sh
----------------------------------------------------------------------
diff --git a/samza-shell/src/main/bash/run-class.sh b/samza-shell/src/main/bash/run-class.sh
index 5aa34cd..5a76793 100755
--- a/samza-shell/src/main/bash/run-class.sh
+++ b/samza-shell/src/main/bash/run-class.sh
@@ -57,7 +57,14 @@ if [ -z "$SAMZA_CONTAINER_NAME" ]; then
 fi
 
 if [ -z "$JAVA_OPTS" ]; then
-  JAVA_OPTS="-Xmx768M -XX:+PrintGCDateStamps -Xloggc:$SAMZA_LOG_DIR/gc.log -Dsamza.log.dir=$SAMZA_LOG_DIR -Dsamza.container.name=$SAMZA_CONTAINER_NAME"
+  COMMON_OPTS="-Xmx768M -XX:+PrintGCDateStamps -Xloggc:$SAMZA_LOG_DIR/gc.log -Dsamza.log.dir=$SAMZA_LOG_DIR -Dsamza.container.name=$SAMZA_CONTAINER_NAME"
+  GC_LOG_ROTATION_OPTS="-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=10241024"
+  JAVA_OPTS="$COMMON_OPTS"
+  # Check whether the JVM supports GC Log rotation, and enable it if so.
+  `java -Xloggc:/dev/null $GC_LOG_ROTATION_OPTS -version 2> /dev/null`
+  if [ $? -eq 0 ] ; then
+    JAVA_OPTS="$JAVA_OPTS $GC_LOG_ROTATION_OPTS"
+  fi
   if [ -f $base_dir/lib/log4j.xml ]; then
     JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=file:$base_dir/lib/log4j.xml"
   fi