confluentinc / kafka-connect-elasticsearch

Kafka Connect Elasticsearch connector
Other
12 stars 435 forks source link

Missed log4j-core.jar in /usr/share/confluent-hub-components/confluentinc-kafka-connect-elasticsearch/lib/ #577

Open nikmarch opened 3 years ago

nikmarch commented 3 years ago

Hey, I deploy my connector as docker image to Kubernetes. When I set CONNECT_LOG4J_ROOT_LOGLEVEL: ERROR the connector throws an error:

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

I was able to fix it by adding the jar and got another error:

 ERROR StatusLogger No Log4j 2 configuration file found. Using default configuration (logging only errors to the console), or user programmatically provided configurations. Set system property 'log4j2.debug' to show Log4j 2 internal initialization logging. See https://logging.apache.org/log4j/2.x/manual/configu

So I need to set LOG4J_CONFIGURATION_FILE: "/etc/kafka/log4j2.properties" and copy the property file to the Image as well. Here is my Dockerfile:

FROM confluentinc/cp-kafka-connect:latest

USER $USER

ENV KAFKA_HEAP_OPTS="-Xms512m -Xmx1g"
RUN /bin/bash -c yum update

COPY . /
ADD log4j/log4j2.properties /etc/kafka/

RUN confluent-hub install --no-prompt confluentinc/kafka-connect-elasticsearch:latest
RUN confluent-hub install --no-prompt confluentinc/connect-transforms:latest

ADD log4j/log4j-core-2.11.1.jar /usr/share/confluent-hub-components/confluentinc-kafka-connect-elasticsearch/lib/

I fixed my problem, but it would be nice to have the jar included into the kafka-connect-elasticsearch plugin

yeikel commented 2 days ago

In the latest versions of the connector I see this

/usr/share/confluent-hub-components/confluentinc-kafka-connect-elasticsearch/lib/log4j-core-2.17.1.jar
/usr/share/confluent-hub-components/confluentinc-kafka-connect-elasticsearch/lib/log4j-api-2.17.1.jar