Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # dev >> [jira] [Commented] (KAFKA-1109) Need to fix GC log configuration code, not able to override KAFKA_GC_LOG_OPTS


Copy link to this message
-
[jira] [Commented] (KAFKA-1109) Need to fix GC log configuration code, not able to override KAFKA_GC_LOG_OPTS

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

Guozhang Wang commented on KAFKA-1109:
--------------------------------------

Actually, why the gc file name should be coupled with the "daemon" option?

> Need to fix GC log configuration code, not able to override KAFKA_GC_LOG_OPTS
> -----------------------------------------------------------------------------
>
>                 Key: KAFKA-1109
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1109
>             Project: Kafka
>          Issue Type: Bug
>    Affects Versions: 0.8, 0.8.1
>         Environment: *nix
>            Reporter: Viktor Kolodrevskiy
>         Attachments: KAFKA_1109_fix.patch
>
>
> kafka-run-class.sh contains GC log code:
> # GC options
> GC_FILE_SUFFIX='-gc.log'
> GC_LOG_FILE_NAME=''
> 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 "
> fi
> So when in my scripts I start kafka and want to override KAFKA_GC_LOG_OPTS by exporting new values I get:
> Exception in thread "main" java.lang.NoClassDefFoundError: daemon
> Caused by: java.lang.ClassNotFoundException: daemon
> That's because shift is not done when KAFKA_GC_LOG_OPTS is set and "daemon" is passed as main class.
> I suggest to replace it with this code:
> # GC options
> GC_FILE_SUFFIX='-gc.log'
> GC_LOG_FILE_NAME=''
> 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 "
> else
>     if [ "$1" = "daemon" ] && [ "$KAFKA_GC_LOG_OPTS" != "" ] ; then
>       shift 2
>     fi
> fi

--
This message was sent by Atlassian JIRA
(v6.1#6144)