Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MINOR: log4j2 upgrade follow-up #18290

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions bin/kafka-run-class.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ 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 -qE "log4j\.[^[:space:]]+$"; then
# Extract Log4j 1.x configuration file path from KAFKA_LOG4J_OPTS
LOG4J1_CONFIG=$(echo "$KAFKA_LOG4J_OPTS" | grep -o 'log4j\.configuration=\S*' | cut -d'=' -f2)

# Enable Log4j 1.x configuration compatibility mode for Log4j 2
export LOG4J_COMPATIBILITY=true
export LOG4J_CONFIGURATION_FILE="$LOG4J1_CONFIG"

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 (
echo %KAFKA_LOG4J_OPTS% | findstr /r /c:"log4j\.[^ ]*$" >nul
IF %ERRORLEVEL% == 0 (
rem Enable Log4j 1.x configuration compatibility mode for Log4j 2
set LOG4J_COMPATIBILITY=true
for /f "tokens=2* delims==" %%G in ("%KAFKA_LOG4J_OPTS%") do set LOG4J_CONFIGURATION_FILE=%%G
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/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