You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by ew...@apache.org on 2016/02/16 21:23:55 UTC

kafka git commit: MINOR: Reconcile differences in .bat & .sh start scripts

Repository: kafka
Updated Branches:
  refs/heads/trunk f355918ec -> 3ee1878d8


MINOR: Reconcile differences in .bat & .sh start scripts

A few minor fixes to reconcile differences between the windows and unix versions of the kafka/zookeeper start scripts that were causing cross-platform inconsistencies during deployment.

- Resolve differences in CLASSPATH setup between .bat and .sh start scripts
- .bat start scripts honor externally provided KAFKA_HEAP_OPTS and KAFKA_LOG4J_OPTS consistent with .sh
- .bat start scripts configure log4j similar to .sh

Author: Matt Fluet <ma...@appian.com>

Reviewers: Eno Thereska <en...@gmail.com>, Grant Henke <gr...@gmail.com>, Ewen Cheslack-Postava <ew...@confluent.io>

Closes #908 from fluetm/scripts-patch


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

Branch: refs/heads/trunk
Commit: 3ee1878d80aa6e3198731159d4479ac393489378
Parents: f355918
Author: Matt Fluet <ma...@appian.com>
Authored: Tue Feb 16 15:23:24 2016 -0500
Committer: Ewen Cheslack-Postava <me...@ewencp.org>
Committed: Tue Feb 16 15:23:24 2016 -0500

----------------------------------------------------------------------
 bin/windows/kafka-run-class.bat        | 17 +++++++++++++----
 bin/windows/kafka-server-start.bat     |  8 ++++++--
 bin/windows/zookeeper-server-start.bat |  8 ++++++--
 3 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/3ee1878d/bin/windows/kafka-run-class.bat
----------------------------------------------------------------------
diff --git a/bin/windows/kafka-run-class.bat b/bin/windows/kafka-run-class.bat
index 1508d84..5709ad9 100644
--- a/bin/windows/kafka-run-class.bat
+++ b/bin/windows/kafka-run-class.bat
@@ -25,7 +25,6 @@ rem Using pushd popd to set BASE_DIR to the absolute path
 pushd %~dp0..\..
 set BASE_DIR=%CD%
 popd
-set CLASSPATH=
 
 IF ["%SCALA_VERSION%"] EQU [""] (
   set SCALA_VERSION=2.10.6
@@ -56,9 +55,7 @@ for %%i in (%BASE_DIR%\examples\build\libs\kafka-examples-*.jar) do (
 )
 
 rem Classpath addition for release
-for %%i in (%BASE_DIR%\libs\*.jar) do (
-	call :concat %%i
-)
+call :concat %BASE_DIR%\libs\*
 
 rem Classpath addition for core
 for %%i in (%BASE_DIR%\core\build\libs\kafka_%SCALA_BINARY_VERSION%*.jar) do (
@@ -75,11 +72,23 @@ IF ["%JMX_PORT%"] NEQ [""] (
 	set KAFKA_JMX_OPTS=%KAFKA_JMX_OPTS% -Dcom.sun.management.jmxremote.port=%JMX_PORT%
 )
 
+rem Log directory to use
+IF ["%LOG_DIR%"] EQU [""] (
+    set LOG_DIR=%BASE_DIR%/logs
+)
+
 rem Log4j settings
 IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
 	set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%BASE_DIR%/config/tools-log4j.properties
+) ELSE (
+  # create logs directory
+  IF not exist %LOG_DIR% (
+      mkdir %LOG_DIR%
+  )
 )
 
+set KAFKA_LOG4J_OPTS=-Dkafka.logs.dir=%LOG_DIR% %KAFKA_LOG4J_OPTS%
+
 rem Generic jvm settings you want to add
 IF ["%KAFKA_OPTS%"] EQU [""] (
 	set KAFKA_OPTS=

http://git-wip-us.apache.org/repos/asf/kafka/blob/3ee1878d/bin/windows/kafka-server-start.bat
----------------------------------------------------------------------
diff --git a/bin/windows/kafka-server-start.bat b/bin/windows/kafka-server-start.bat
index 6a5aa9f..315507e 100644
--- a/bin/windows/kafka-server-start.bat
+++ b/bin/windows/kafka-server-start.bat
@@ -20,7 +20,11 @@ IF [%1] EQU [] (
 )
 
 SetLocal
-set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
-set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
+IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
+    set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
+)
+IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
+    set KAFKA_HEAP_OPTS=-Xmx1G -Xms1G
+)
 %~dp0kafka-run-class.bat kafka.Kafka %*
 EndLocal

http://git-wip-us.apache.org/repos/asf/kafka/blob/3ee1878d/bin/windows/zookeeper-server-start.bat
----------------------------------------------------------------------
diff --git a/bin/windows/zookeeper-server-start.bat b/bin/windows/zookeeper-server-start.bat
index 9836283..c67b997 100644
--- a/bin/windows/zookeeper-server-start.bat
+++ b/bin/windows/zookeeper-server-start.bat
@@ -20,7 +20,11 @@ IF [%1] EQU [] (
 )
 
 SetLocal
-set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
-set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
+IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
+    set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/log4j.properties
+)
+IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
+    set KAFKA_HEAP_OPTS=-Xmx512M -Xms512M
+)
 %~dp0kafka-run-class.bat org.apache.zookeeper.server.quorum.QuorumPeerMain %*
 EndLocal