You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "J Potter (JIRA)" <ji...@apache.org> on 2014/06/30 19:16:26 UTC

[jira] [Commented] (KAFKA-1204) Add KAFKA_LOG_DIR to allow LOG_DIR to be outside of code dir

    [ https://issues.apache.org/jira/browse/KAFKA-1204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14047865#comment-14047865 ] 

J Potter commented on KAFKA-1204:
---------------------------------

Looks like a slightly easier patch works for 0.8.1:

 # create logs directory
-LOG_DIR=$base_dir/logs
+if [ -z "$KAFKA_LOG_DIR" ]; then
+  LOG_DIR=$base_dir/logs
+else
+  LOG_DIR=$KAFKA_LOG_DIR
+fi
+

-Jeff

> Add KAFKA_LOG_DIR to allow LOG_DIR to be outside of code dir
> ------------------------------------------------------------
>
>                 Key: KAFKA-1204
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1204
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>            Reporter: J Potter
>              Labels: patch
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> 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 "$@"



--
This message was sent by Atlassian JIRA
(v6.2#6252)