-
Notifications
You must be signed in to change notification settings - Fork 14.7k
KAFKA-9366: Upgrade log4j to log4j2 #17373
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
Changes from all commits
4cc09d9
d71bbdf
347388a
9fc1203
d12f311
7200b43
7419f5f
6ce4e5f
d69df89
98157cb
8ec412d
84c467c
32ae43c
ae77d17
dfdcb1c
ae45089
d1ed1d2
403002c
bafb177
6dc14fd
aa06946
2b224ea
4ac974e
125f6f1
b301c92
c00618a
07376e3
686b56b
5fc37b4
7408589
1340837
f10e2d2
c959967
97509f4
5f5f0ae
20088a3
c30b309
2b6be7e
7032ffd
168557b
89047c0
efaab51
dfdf33b
0aff2c7
4aee10f
5e1eaf5
a1c2294
7672fa5
f3a68e1
9343fc3
5761828
723e87c
40a80f4
a6fa0ac
17cc7fc
8fa5a73
1d06e84
e488b0a
89b2168
8113166
2b749e8
07d1bb1
87fc720
56b306c
6d41bcd
064fe52
762a54d
3eb5522
fb61428
99cc467
440463a
fc4e351
9bf59d9
23e391b
38f6155
eab8334
fd72409
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,8 +21,12 @@ then | |
| fi | ||
| base_dir=$(dirname $0) | ||
|
|
||
| if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then | ||
| export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could break some existing Kafka installations. If users are extracting in place or copying previous config files to a new installation directory, they will be expecting the log4j.properties to still work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The switch from the legacy to the new configuration format can be based on the presence of specific files: if [ -f "$base_dir/../config/log4j.properties" ]; then
echo DEPRECATED: Using Log4j 1.x configuration file \$KAFKA_HOME/config/log4j.properties >&2
echo To use a Log4j 2.x configuration, create a \$KAFKA_HOME/config/log4j2.xml file and remove the Log4j 1.x configration. >&2
echo See https://logging.apache.org/log4j/2.x/migrate-from-log4j1.html#Log4j2ConfigurationFormat for details about Log4j configuration file migration. >&2
export KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:$base_dir/../config/log4j.properties"
elif [ -f "$base_dir/../config/log4j2.xml" ]; then
export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/log4j2.xml"
fiThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I’m not sure why we override the Noted that we do not require users to strictly use the path |
||
| 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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we do this in many files instead of kafka-run-class?