ppkarwasz commented on code in PR #17373:
URL: https://github.com/apache/kafka/pull/17373#discussion_r1843491362


##########
bin/connect-distributed.sh:
##########
@@ -22,8 +22,15 @@ fi
 
 base_dir=$(dirname $0)
 
-if [ "x$KAFKA_LOG4J_OPTS" = "x" ]; then
+if [ -f "$base_dir/../config/connect-log4j.properties" ]; then
+    echo DEPRECATED: Using Log4j 1.x configuration file 
\$KAFKA_HOME/config/connect-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/connect-log4j.properties"
+elif [ -f "$base_dir/../config/connect-log4j2.properties" ]; then
+    export 
KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/connect-log4j2.properties"
+elif [ -f "$base_dir/../config/connect-log4j2.xml" ]; then
+    export 
KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$base_dir/../config/connect-log4j2.xml"

Review Comment:
   I think that `log4j.properties` should have a higher priority than 
`log4j2.properties`:
   
   - Fresh installations of Kafka 4.x will only have a `log4j2.properties` file.
   - If we find a `log4j.properties` file, it means that it is either an 
upgraded installation of Kafka or the user copied their customized 
configuration.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to