Skip to content

Hive-29661: SLF4J multi-binding fix for beeline start#6540

Open
aturoczy wants to merge 2 commits into
apache:masterfrom
aturoczy:HIVE-29661
Open

Hive-29661: SLF4J multi-binding fix for beeline start#6540
aturoczy wants to merge 2 commits into
apache:masterfrom
aturoczy:HIVE-29661

Conversation

@aturoczy

Copy link
Copy Markdown

What changes were proposed in this pull request?

Removing the SLF4J noise from the first startup lines would also make Beeline feel cleaner and more professional for both new and existing users. Like:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/aturoczy/src/hive/packaging/target/apache-hive-4.3.0-SNAPSHOT-bin/apache-hive-4.3.0-SNAPSHOT-bin/lib/log4j-slf4j-impl-2.25.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/aturoczy/hadoop-3.4.2/share/hadoop/common/lib/slf4j-reload4j-1.7.36.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]

Why are the changes needed?

To remove unnecessary noise from user interface. For user this information does not need at all.

Does this PR introduce any user-facing change?

Yes, the users does not see SLF4J nonsense messages at beeline start.

How was this patch tested?

Manually tested.

Comment thread bin/ext/beeline.sh
case "$x" in
*slf4j-reload4j*|*slf4j-log4j12*|*log4j-1.2*|*reload4j*) continue ;;
esac
beelineClasspath="${beelineClasspath}:${x}"

@difin difin Jun 22, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beelineClasspath is seeded from HADOOP_CLASSPATH, but hadoop classpath --glob already includes those paths, so appending all glob entries duplicates them. It would be good to add a guard before the append to skip entries already in beelineClasspath:

    if [[ ":${beelineClasspath}:" == *":${x}:"* ]]
    then
        continue
    fi

immediately before this line:

    beelineClasspath="${beelineClasspath}:${x}"

beelineClasspath is seeded from HADOOP_CLASSPATH, then extended with
every entry from `hadoop classpath --glob`. Hadoop's own startup builds
that glob from HADOOP_CLASSPATH plus its own jars/confs, so the two
overlap and the same jar would land on the classpath twice. Add a
literal-string substring guard before each append to skip entries
already present; wrap both haystack and needle in `:` so the match is
position-safe and partial-name jars (e.g. `b` inside `ab`) don't
spuriously match.
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@difin difin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants