Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-1204

Add KAFKA_LOG_DIR to allow LOG_DIR to be outside of code dir

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: 0.8.2.0
    • Component/s: core
    • Labels:

      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)/..

      1. 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

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jpotter J Potter
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 10m
                  10m
                  Remaining:
                  Remaining Estimate - 10m
                  10m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified