You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kafka.apache.org by "Michael Noll (JIRA)" <ji...@apache.org> on 2015/11/04 10:22:28 UTC
[jira] [Resolved] (KAFKA-2728) kafka-run-class.sh: incorrect path
to tools-log4j.properties for KAFKA_LOG4J_OPTS
[ https://issues.apache.org/jira/browse/KAFKA-2728?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Noll resolved KAFKA-2728.
---------------------------------
Resolution: Invalid
> kafka-run-class.sh: incorrect path to tools-log4j.properties for KAFKA_LOG4J_OPTS
> ---------------------------------------------------------------------------------
>
> Key: KAFKA-2728
> URL: https://issues.apache.org/jira/browse/KAFKA-2728
> Project: Kafka
> Issue Type: Bug
> Components: config, core
> Affects Versions: 0.9.0.0
> Reporter: Michael Noll
>
> I noticed that the {{bin/kafka-run-class.sh}} and the {{bin/windows/kafka-run-class.bat}} scripts in current trunk (as of commit e466ccd) seems to set up the KAFKA_LOG4J_OPTS environment variable incorrectly. Noticeably, the way to construct the path to {{config/tools-log4j.properties}} is wrong, and it is inconsistent to how the other bin scripts configure the paths to their {{config/*.properties}} files.
> Example: bin/kafka-run-class.sh (one of the two buggy scripts)
> {code}
> 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
> ...snip...
> {code}
> Example: bin/kafka-server-start.sh (a correct script)
> {code}
> if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
> export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
> fi
> {code}
> In the examples above, note the difference between:
> {code}
> # Without ".."
> file:$base_dir/config/tools-log4j.properties
> # With ".."
> file:$base_dir/../config/log4j.properties
> {code}
> *How to fix*
> Set up {{KAFKA_LOG4J_OPTS}} as in {{kafka-run-class.sh}} follows:
> {code}
> KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/tools-log4j.properties"
> {code}
> Set up {{KAFKA_LOG4J_OPTS}} as in {{kafka-run-class.bat}} follows (careful, I am not that familiar with Windows .bat scripting):
> {code}
> set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%BASE_DIR%/../config/tools-log4j.properties
> {code}
> Alternatively, for the windows script, we could use the same code variant we use in e.g. {{kafka-server-start.bat}}, where we use {{~dp0}} instead of {{BASE_DIR}} (I'd opt for this variant so that the windows scripts are consistent):
> {code}
> set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%~dp0../../config/tools-log4j.properties
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)