I figured it out. Here is the solution.
The connect-log4j.properties file is:
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern =[%d] %p %X{dbz.connectorType}|%X{dbz.connectorName}|%X{dbz.connectorContext} %m (%c)%n
# loggers from CONNECT_LOG4J_LOGGERS env variable
log4j.logger.org.apache.kafka.connect=FATAL
The dockerfile is:
FROM confluentinc/cp-kafka-connect:7.9.0
COPY plugins /usr/share/java
COPY logging/connect-log4j.properties /etc/kafka/overrides/connect-log4j.properties
USER root
RUN yum install -y unzip
RUN yum update glibc-common -y
ARG NewRelic=https://download.newrelic.com/newrelic/java-agent/newrelic-agent/current/newrelic-java.zip
RUN curl -O $NewRelic
RUN unzip -o newrelic-java.zip -d /opt
USER appuser
#add this line in to increase log level
ENV CONNECT_LOG4J_LOGGERS="org.apache.kafka.connect=FATAL"
ENV KAFKA_LOG4J_OPTS="-Dlog4j.configuration=file:/etc/kafka/overrides/connect-log4j.properties"
Basically plugging in the properties file to the environment variable KAFKA_LOG4J_OPTS
Thanks!