Description
The kafka-run-class.sh script currently generates a LOG_DIR variable and expects the path under base_dir/logs to be writeable by the process, without a way of overriding it.
I think a simple change as below would allow ops folks to fire it up and point the LOG_DIR elsewhere, as desired.
bin/kafka-run-class.sh
@@ -23,9 +23,11 @@ fi
base_dir=$(dirname $0)/..
- create logs directory
-LOG_DIR=$base_dir/logs
-if [ ! -d $LOG_DIR ]; then
- mkdir $LOG_DIR
+if [ -z "KAFKA_LOG_DIR" ]; then
+ KAFKA_LOG_DIR=$base_dir/logs
+fi
+if [ ! -d $KAFKA_LOG_DIR ]; then
+ mkdir $KAFKA_LOG_DIR
fi
if [ -z "$SCALA_VERSION" ]; then
@@ -98,7 +100,7 @@ if [ "$1" = "daemon" ] && [ -z "$KAFKA_GC_LOG_OPTS"] ; then
shift
GC_LOG_FILE_NAME=$1$GC_FILE_SUFFIX
shift
- KAFKA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps "
+ KAFKA_GC_LOG_OPTS="-Xloggc:$KAFKA_LOG_DIR/$GC_LOG_FILE_NAME -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps "
fi
exec $JAVA $KAFKA_HEAP_OPTS $KAFKA_JVM_PERFORMANCE_OPTS $KAFKA_GC_LOG_OPTS $KAFKA_JMX_OPTS $KAFKA_LOG4J_OPTS -cp $CLASSPATH $KAFKA_OPTS "$@"
Attachments
Issue Links
- is duplicated by
-
KAFKA-1401 Log dir hardcoded in bin/kafka-run-class.sh
- Closed