Repository: kafka
Updated Branches:
  refs/heads/trunk 23df2199d -> 75b0f30c4


KAFKA-5077; fix GC logging arguments for Java 9

Author: Xavier Léauté <xav...@confluent.io>

Reviewers: Ismael Juma <ism...@juma.me.uk>

Closes #2863 from xvrl/fix-jdk9-gc-logs


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/75b0f30c
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/75b0f30c
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/75b0f30c

Branch: refs/heads/trunk
Commit: 75b0f30c448c12199263e3d82708c2cb6817d702
Parents: 23df219
Author: Xavier Léauté <xav...@confluent.io>
Authored: Thu Aug 10 01:43:02 2017 +0100
Committer: Ismael Juma <ism...@juma.me.uk>
Committed: Thu Aug 10 02:06:53 2017 +0100

----------------------------------------------------------------------
 bin/kafka-run-class.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/75b0f30c/bin/kafka-run-class.sh
----------------------------------------------------------------------
diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh
index 845685d..137f4cd 100755
--- a/bin/kafka-run-class.sh
+++ b/bin/kafka-run-class.sh
@@ -250,7 +250,14 @@ GC_FILE_SUFFIX='-gc.log'
 GC_LOG_FILE_NAME=''
 if [ "x$GC_LOG_ENABLED" = "xtrue" ]; then
   GC_LOG_FILE_NAME=$DAEMON_NAME$GC_FILE_SUFFIX
-  KAFKA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc 
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps 
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
+  # the first segment of the version number, which is '1' for releases before 
Java 9
+  # it then becomes '9', '10', ...
+  JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version 
"([^.-]*).*"/\1/p')
+  if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
+    
KAFKA_GC_LOG_OPTS="-Xlog:gc*:file=$LOG_DIR/$GC_LOG_FILE_NAME:time,tags:filecount=10,filesize=102400"
+  else
+    KAFKA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc 
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps 
-XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
+  fi
 fi
 
 # If Cygwin is detected, classpath is converted to Windows format.

Reply via email to