kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: KAFKA-3272: Add debugging options to kafka-run-class.sh so we can easily run remote debugging
Date Tue, 23 Feb 2016 23:55:14 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 73ecd7a17 -> aeb9c2adc


KAFKA-3272: Add debugging options to kafka-run-class.sh so we can easily run remote debugging

…able remote debugging to Kafka tools scripts

Author: Christian Posta <christian.posta@gmail.com>

Reviewers: Grant Henke, Gwen Shapira

Closes #955 from christian-posta/ceposta-enable-jvm-debugging-opts


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

Branch: refs/heads/trunk
Commit: aeb9c2adcfe5fb99490fb15163ebcfd1d75d34c1
Parents: 73ecd7a
Author: Christian Posta <christian.posta@gmail.com>
Authored: Tue Feb 23 15:55:09 2016 -0800
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Tue Feb 23 15:55:09 2016 -0800

----------------------------------------------------------------------
 bin/kafka-run-class.sh          | 22 ++++++++++++++++++++++
 bin/windows/kafka-run-class.bat | 23 +++++++++++++++++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/aeb9c2ad/bin/kafka-run-class.sh
----------------------------------------------------------------------
diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh
index cb2556f..344e47f 100755
--- a/bin/kafka-run-class.sh
+++ b/bin/kafka-run-class.sh
@@ -120,6 +120,28 @@ if [ -z "$KAFKA_OPTS" ]; then
   KAFKA_OPTS=""
 fi
 
+# Set Debug options if enabled
+if [ "x$KAFKA_DEBUG" != "x" ]; then
+
+    # Use default ports
+    DEFAULT_JAVA_DEBUG_PORT="5005"
+
+    if [ -z "$JAVA_DEBUG_PORT" ]; then
+        JAVA_DEBUG_PORT="$DEFAULT_JAVA_DEBUG_PORT"
+    fi
+
+    # Use the defaults if JAVA_DEBUG_OPTS was not set
+    DEFAULT_JAVA_DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=${DEBUG_SUSPEND_FLAG:-n},address=$JAVA_DEBUG_PORT"
+    if [ -z "$JAVA_DEBUG_OPTS" ]; then
+        JAVA_DEBUG_OPTS="$DEFAULT_JAVA_DEBUG_OPTS"
+    fi
+
+
+
+    echo "Enabling Java debug options: $JAVA_DEBUG_OPTS"
+    KAFKA_OPTS="$JAVA_DEBUG_OPTS $KAFKA_OPTS"
+fi
+
 # Which java to use
 if [ -z "$JAVA_HOME" ]; then
   JAVA="java"

http://git-wip-us.apache.org/repos/asf/kafka/blob/aeb9c2ad/bin/windows/kafka-run-class.bat
----------------------------------------------------------------------
diff --git a/bin/windows/kafka-run-class.bat b/bin/windows/kafka-run-class.bat
index 5709ad9..b16717c 100644
--- a/bin/windows/kafka-run-class.bat
+++ b/bin/windows/kafka-run-class.bat
@@ -94,6 +94,29 @@ IF ["%KAFKA_OPTS%"] EQU [""] (
 	set KAFKA_OPTS=
 )
 
+set DEFAULT_JAVA_DEBUG_PORT=5005
+set DEFAULT_DEBUG_SUSPEND_FLAG=n
+rem Set Debug options if enabled
+IF ["%KAFKA_DEBUG%"] NEQ [""] (
+
+
+	IF ["%JAVA_DEBUG_PORT%"] EQU [""] (
+		set JAVA_DEBUG_PORT=%DEFAULT_JAVA_DEBUG_PORT%
+	)
+
+	IF ["%DEBUG_SUSPEND_FLAG%"] EQU [""] (
+		set DEBUG_SUSPEND_FLAG=%DEFAULT_DEBUG_SUSPEND_FLAG%
+	)
+	set DEFAULT_JAVA_DEBUG_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=!DEBUG_SUSPEND_FLAG!,address=!JAVA_DEBUG_PORT!
+
+	IF ["%JAVA_DEBUG_OPTS%"] EQU [""] (
+		set JAVA_DEBUG_OPTS=!DEFAULT_JAVA_DEBUG_OPTS!
+	)
+
+	echo Enabling Java debug options: !JAVA_DEBUG_OPTS!
+	set KAFKA_OPTS=!JAVA_DEBUG_OPTS! !KAFKA_OPTS!
+)
+
 rem Which java to use
 IF ["%JAVA_HOME%"] EQU [""] (
 	set JAVA=java


Mime
View raw message