Change log level for smallrye kafka consumer extension

787 views Asked by At

I have a quarkus app which uses the quarkus-smallrye-reactive-messaging-kafka extension.

At runtime it produces a tons of debug logs:

rent-orchestrator-service    | 16:44:11.508 [smallrye-kafka-consumer-thread-0] DEBUG org.apache.kafka.clients.consumer.internals.Fetcher - [Consumer clientId=kafka-consumer-rent-service-events, groupId=rent-orchestrator-service] Added READ_UNCOMMITTED fetch request for partition rent-service-events-0 at position FetchPosition{offset=0, offsetEpoch=Optional.empty, currentLeader=LeaderAndEpoch{leader=Optional[kafka:9092 (id: 1 rack: null)], epoch=0}} to node kafka:9092 (id: 1 rack: null)
rent-orchestrator-service    | 16:44:11.508 [smallrye-kafka-consumer-thread-0] DEBUG org.apache.kafka.clients.FetchSessionHandler - [Consumer clientId=kafka-consumer-rent-service-events, groupId=rent-orchestrator-service] Built incremental fetch (sessionId=1774069795, epoch=565) for node 1. Added 0 partition(s), altered 0 partition(s), removed 0 partition(s), replaced 0 partition(s) out of 1 partition(s)
rent-orchestrator-service    | 16:44:11.508 [smallrye-kafka-consumer-thread-0] DEBUG org.apache.kafka.clients.consumer.internals.Fetcher - [Consumer clientId=kafka-consumer-rent-service-events, groupId=rent-orchestrator-service] Sending READ_UNCOMMITTED IncrementalFetchRequest(toSend=(), toForget=(), toReplace=(), implied=(rent-service-events-0), canUseTopicIds=True) to broker kafka:9092 (id: 1 rack: null)
rent-orchestrator-service    | 16:44:11.508 [smallrye-kafka-consumer-thread-0] DEBUG org.apache.kafka.clients.NetworkClient - [Consumer clientId=kafka-consumer-rent-service-events, groupId=rent-orchestrator-service] Sending FETCH request with header RequestHeader(apiKey=FETCH, apiVersion=12, clientId=kafka-consumer-rent-service-events, correlationId=678) and timeout 30000 to node 1: FetchRequestData(clusterId=null, replicaId=-1, maxWaitMs=500, minBytes=1, maxBytes=52428800, isolationLevel=0, sessionId=1774069795, sessionEpoch=565, topics=[], forgottenTopicsData=[], rackId='')

I tried to set a different log level in the application.properties but it doesn't work:

quarkus.log.level=INFO
quarkus.log.category."org.apache.kafka".level=INFO

How can I solve?

1

There are 1 answers

0
Clement On

Make sure you do not have another logger in your classpath. So, if you are using maven, check with mvn dependency:tree and exclude any logger that may be pulled:

<dependency>
   <groupId>foo-that-pull-another-logger</groupId>
   <artifactId>...</artifactId>
   <version>...</version>
   <exclusions>
     <exclusion>
        <groupId>the-other-logger-groupid</groupId>
        <artifactId>the-other-logger-artifactid</artifactid>
     </exclusion>
   </exclusions>
</dependency>

Then, in the application.properties, add (as you did)

quarkus.log.level=INFO
quarkus.log.category."org.apache.kafka".level=INFO