Search code examples
apache-kafkalog4japache-kafka-connect

How to configure Kafka Connect logs?


I'm using confluent kafka jdbc connector(https://github.com/confluentinc/kafka-connect-jdbc), but I don't find the /etc/kafka/connect-log4j.properties file, which is described on https://docs.confluent.io/platform/current/connect/logging.html. I want to know how this connector output logs by log4j.

I think the log config files(log4j.properties) should be placed in the src/main/resources directory, but I only found the log files in the src/test/resources directory. Why do files in this path take effect or is there any default configuration for kafka conenct?

Here is the configuration of log4j in pom.xml:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <scope>test</scope>
</dependency>

Solution

  • Logs are not unique to a specific connector plugin.

    When you run connect-distributed.sh file, it includes a reference to the log4j.properties file that is used by the whole worker.

    src/main/resources is part of the Kafka source code. You shouldn't run Connectors from the source code. The JDBC Connector should be added to connect-distributed.properties > plugin.path setting... Then you use connect-distributed.sh to run a server, which is where logs are output.