diff --git a/bin/kafka-run-class.sh b/bin/kafka-run-class.sh index 8bd1b17623b..3463389d3c0 100755 --- a/bin/kafka-run-class.sh +++ b/bin/kafka-run-class.sh @@ -225,7 +225,7 @@ if [ -z "$KAFKA_LOG4J_OPTS" ]; then (( WINDOWS_OS_FORMAT )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}") KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=${LOG4J_DIR}" else - if echo "$KAFKA_LOG4J_OPTS" | grep -E "log4j\.[^[:space:]]+(\.properties|\.xml)$"; then + if echo "$KAFKA_LOG4J_OPTS" | grep -E "log4j\.[^[:space:]]+(\.properties|\.xml)$" >/dev/null; then # Enable Log4j 1.x configuration compatibility mode for Log4j 2 export LOG4J_COMPATIBILITY=true echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2