Skip to content

Logging Configuration(log4j) Issues with Elastic and Kafka Clients  #107559

Open
@foobarrer

Description

@foobarrer

Description

Issue: Logging Configuration Issues with Elastic and Kafka Clients

I'm currently using both elastic-client and kafka-client in my project. I initially excluded the log4j dependency and opted for logback-classic as my primary logging framework. Unfortunately, this resulted in a startup error for my project.

Moreover, when I switched to log4j from logback and added a simple configuration file named log4j.properties and log4j2.properties (with the log-level set to 'info'), the configuration didn't take effect. I was still seeing a plethora of debug-level logs in my console, which was not the desired outcome.

In an attempt to resolve this, I reverted to using logback, retaining the log4j dependency (as its removal resulted in an error), and added a logback.xml configuration file. However, the log-level setting in logback.xml still didn't work as expected, which is quite frustrating.

Upon examining the source code, I noticed several direct imports from log4j. Although there's a class called org.elasticsearch.common.logging.Loggers, I couldn't understand the necessity of direct log4j usage.

Suggestion: Unified Logging Framework

Would it be possible to eliminate the log4j dependency and its imports from the Gradle file and the source code, and instead, utilize SLF4J as the unified logging framework? This would provide the flexibility for users to choose the logging framework that best suits their needs.
I can still found the log4j dependency in the gradle file in the current main branch

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions