Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions bin/connect-distributed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ base_dir=$(dirname $0)

if [ -z "$KAFKA_LOG4J_OPTS" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/connect-log4j2.yaml"
elif echo "$KAFKA_LOG4J_OPTS" | grep -qE "log4j\.[^[:space:]]+$"; then
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the \$KAFKA_HOME/config/connect-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
Expand Down
4 changes: 0 additions & 4 deletions bin/connect-mirror-maker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ base_dir=$(dirname $0)

if [ -z "$KAFKA_LOG4J_OPTS" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/connect-log4j2.yaml"
elif echo "$KAFKA_LOG4J_OPTS" | grep -qE "log4j\.[^[:space:]]+$"; then
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the \$KAFKA_HOME/config/connect-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
Expand Down
4 changes: 0 additions & 4 deletions bin/connect-standalone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ base_dir=$(dirname $0)

if [ -z "$KAFKA_LOG4J_OPTS" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/connect-log4j2.yaml"
elif echo "$KAFKA_LOG4J_OPTS" | grep -qE "log4j\.[^[:space:]]+$"; then
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the \$KAFKA_HOME/config/connect-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
Expand Down
7 changes: 7 additions & 0 deletions bin/kafka-run-class.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,13 @@ if [ -z "$KAFKA_LOG4J_OPTS" ]; then
(( WINDOWS_OS_FORMAT )) && LOG4J_DIR=$(cygpath --path --mixed "${LOG4J_DIR}")
KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:${LOG4J_DIR}"
else
if echo "$KAFKA_LOG4J_OPTS" | grep -E "log4j\.[^[:space:]]+(\.properties|\.xml)$"; then
# Enable Log4j 1.x configuration compatibility mode for Log4j 2
export LOG4J_COMPATIBILITY=true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frankvicky could you please test the compatibility on your local?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From document, set one of confituration from log4j1.compatibility and log4j.configuration if needing to install log4j1 to log4j2 bridge. It looks like we can set LOG4J_COMPATIBILITY=true only if LOG4J1_CONFIG has properties file. Also, setting LOG4J_CONFIGURATION_FILE="$LOG4J1_CONFIG" only if LOG4J1_CONFIG doesn't have properties file.

https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#ConfigurationCompatibility

echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the \$KAFKA_HOME/config/tools-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
fi
# create logs directory
if [ ! -d "$LOG_DIR" ]; then
mkdir -p "$LOG_DIR"
Expand Down
4 changes: 0 additions & 4 deletions bin/kafka-server-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ base_dir=$(dirname $0)

if [ -z "$KAFKA_LOG4J_OPTS" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/log4j2.yaml"
elif echo "$KAFKA_LOG4J_OPTS" | grep -qE "log4j\.[^[:space:]]+$"; then
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the \$KAFKA_HOME/config/log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
fi

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
Expand Down
7 changes: 0 additions & 7 deletions bin/windows/connect-distributed.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ popd
rem Log4j settings
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
set KAFKA_LOG4J_OPTS=-Dlog4j2.configurationFile=%BASE_DIR%/config/connect-log4j2.yaml
) ELSE (
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*$" >nul
IF %ERRORLEVEL% == 0 (
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended.
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the %BASE_DIR%/config/connect-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
)
)

"%~dp0kafka-run-class.bat" org.apache.kafka.connect.cli.ConnectDistributed %*
Expand Down
7 changes: 0 additions & 7 deletions bin/windows/connect-standalone.bat
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ popd
rem Log4j settings
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
set KAFKA_LOG4J_OPTS=-Dlog4j2.configurationFile=%BASE_DIR%/config/connect-log4j2.yaml
) ELSE (
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*$" >nul
IF %ERRORLEVEL% == 0 (
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended.
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration.
echo You can also use the %BASE_DIR%/config/connect-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration.
)
)

"%~dp0kafka-run-class.bat" org.apache.kafka.connect.cli.ConnectStandalone %*
Expand Down
9 changes: 9 additions & 0 deletions bin/windows/kafka-run-class.bat
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ rem Log4j settings
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
set KAFKA_LOG4J_OPTS=-Dlog4j.configuration=file:%BASE_DIR%/config/tools-log4j.properties
) ELSE (
rem Check if Log4j 1.x configuration options are present in KAFKA_LOG4J_OPTS
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*(\.properties|\.xml)$" >nul
IF %ERRORLEVEL% == 0 (
rem Enable Log4j 1.x configuration compatibility mode for Log4j 2
set LOG4J_COMPATIBILITY=true
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended. >&2
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
echo You can also use the %BASE_DIR%/config/tool-log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration. >&2
)
rem create logs directory
IF not exist "%LOG_DIR%" (
mkdir "%LOG_DIR%"
Expand Down
7 changes: 0 additions & 7 deletions bin/windows/kafka-server-start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ IF [%1] EQU [] (
SetLocal
IF ["%KAFKA_LOG4J_OPTS%"] EQU [""] (
set KAFKA_LOG4J_OPTS=-Dlog4j2.configurationFile=%~dp0../../config/log4j2.yaml
) ELSE (
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*$" >nul
IF %ERRORLEVEL% == 0 (
echo DEPRECATED: A Log4j 1.x configuration file has been detected, which is no longer recommended.
echo To use a Log4j 2.x configuration, please see https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration.
echo You can also use the %~dp0../../config/log4j2.yaml file as a starting point. Make sure to remove the Log4j 1.x configuration after completing the migration.
)
)
IF ["%KAFKA_HEAP_OPTS%"] EQU [""] (
rem detect OS architecture
Expand Down
Loading
Loading