Status

Current state: Under Discussion

Discussion thread: here

Vote thread: here

JIRA:

Motivation

Kafka still relies on SLF4J1 as its logging interface, significantly restricting users when selecting logging backends. Users must either ensure their preferred framework appears first in the classpath order or remove other logging frameworks entirely—both approaches require manual JAR file manipulation.

With the introduction of SLF4J2, a new system property -Dslf4j.provider becomes available, allowing users to select logging backends through simple configuration rather than modifying JAR files. 


Note: The rationale for this KIP is that upgrading SLF4J necessitates corresponding provider upgrades, which constitutes a breaking change and should be delivered in Kafka 5.0

More discussions: https://github.com/apache/kafka/pull/16260#issuecomment-2159632052

Public Interfaces

Update the below files to upgrade slf4j

Proposed Changes

  1. Upgrade slf4j from 1.7.36 to 2.0.17
  2. Add a new system variable to the kafka-run-class  (sh & bat) script to define -Dslf4j.provider.
  3. Define the default logging framework for Kafka

Compatibility, Deprecation, and Migration Plan

Test Plan

Imitate the user's behavior by manually adding or replacing the dependent logging jars and assigning the corresponding system property by -Dslf4j.provider .
After that, try starting a Kafka service and see if there are any warnings or errors. Make sure Kafka still usually works after changing the logging framework.

Rejected Alternatives