Skip to content

Conversation

@reta
Copy link
Collaborator

@reta reta commented Mar 17, 2023

Description

Interesting issue was reported recently. The OpenSearch core does not use SLF4J (but LOG4J2) however some plugins do:

./plugins/opensearch-ml/slf4j-api-1.7.36.jar
./plugins/opensearch-security/slf4j-api-1.7.30.jar
./plugins/opensearch-alerting/slf4j-api-1.7.30.jar
./plugins/opensearch-sql/slf4j-api-1.7.36.jar
./plugins/opensearch-sql/slf4j-reload4j-1.7.36.jar

The security plugin bundles slf4j-api but there is no binder to bridge SLF4J to LOG4J2. As the result, the following warnings prints out on startup:

[2023-03-17T14:00:00,953][WARN ][stderr                   ] [host] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".                  
[2023-03-17T14:00:00,954][WARN ][stderr                   ] [host] SLF4J: Defaulting to no-operation (NOP) logger implementation                                         
[2023-03-17T14:00:00,954][WARN ][stderr                   ] [host] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.                                                                                                                                                                                                                  
[2023-03-17T14:00:00,965][INFO ][o.o.s.s.t.SSLConfig      ] [host] SSL dual mode is disabled                                                            

Issues Resolved

Closes opensearch-project/OpenSearch#6663

Testing

The integration test configuration included log4j-slf4j-impl so the issue didn't manifest, but when only tests are run, same message in error log:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Check List

  • New functionality includes testing
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Copy link
Member

@DarshitChanpura DarshitChanpura left a comment

Choose a reason for hiding this comment

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

Nice find @reta!

@peternied peternied merged commit 575c2bc into opensearch-project:main Mar 20, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2564-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 575c2bc1e7283398ef448c404f480bd7b1eddef5
# Push it to GitHub
git push --set-upstream origin backport/backport-2564-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2564-to-2.x.

reta added a commit to reta/security that referenced this pull request Mar 20, 2023
DarshitChanpura pushed a commit that referenced this pull request Mar 20, 2023
MaciejMierzwa pushed a commit to MaciejMierzwa/security that referenced this pull request Apr 20, 2023
MaciejMierzwa pushed a commit to MaciejMierzwa/security that referenced this pull request Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"

3 participants