KAFKA-2407: Only create log directory when it will be used

This commit is contained in:
Grant Henke 2015-08-05 12:37:07 -05:00
parent 9cefb2a0fb
commit 49a8dd4218
1 changed files with 11 additions and 9 deletions

View File

@ -22,15 +22,6 @@ fi
base_dir=$(dirname $0)/..
# create logs directory
if [ "x$LOG_DIR" = "x" ]; then
LOG_DIR="$base_dir/logs"
fi
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR"
fi
if [ -z "$SCALA_VERSION" ]; then
SCALA_VERSION=2.10.5
fi
@ -96,9 +87,20 @@ if [ $JMX_PORT ]; then
KAFKA_JMX_OPTS="$KAFKA_JMX_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT "
fi
# Log directory to use
if [ "x$LOG_DIR" = "x" ]; then
LOG_DIR="$base_dir/logs"
fi
# Log4j settings
if [ -z "$KAFKA_LOG4J_OPTS" ]; then
# Log to console. This is a tool.
KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/config/tools-log4j.properties"
else
# create logs directory and set kafka.logs.dir
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR"
fi
fi
KAFKA_LOG4J_OPTS="-Dkafka.logs.dir=$LOG_DIR $KAFKA_LOG4J_OPTS"