Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.3] Switch to log4j logger (#1751) #1791

Conversation

DarshitChanpura
Copy link
Member

Description

In OpenSearch 1.3.0 we removed an explicit dependency on log4j
#1563 this caused the
log4j-slf4j-impl-X.XX.X.jar file no longer to be included in the plugin.
When the plugin started up the default no-op logger was used instead.
This prevented the security plugin from logging anything, yikes.

When looking at the other opensearch plugins, none of them use slf4.
Rather than continue using a seperate logging process, moving to the
standard log4j Logger/LogManager.

Tested this change on 2.0.0-alpha distribution and logging works as
expected.

Signed-off-by: Peter Nied [email protected]
(cherry picked from commit 54a920b)

  • Category : Refactoring

Issues Resolved

Backport PR #1751

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.

In OpenSearch 1.3.0 we removed an explicit dependency on log4j
opensearch-project#1563 this caused the
log4j-slf4j-impl-X.XX.X.jar file no longer to be included in the plugin.
When the plugin started up the default no-op logger was used instead.
This prevented the security plugin from logging anything, yikes.

When looking at the other opensearch plugins, none of them use slf4.
Rather than continue using a seperate logging process, moving to the
standard log4j Logger/LogManager.

Tested this change on 2.0.0-alpha distribution and logging works as
expected.

Signed-off-by: Peter Nied <[email protected]>
(cherry picked from commit 54a920b)
@DarshitChanpura DarshitChanpura requested a review from a team April 25, 2022 20:21
@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2022

Codecov Report

Merging #1791 (f9c2f36) into 1.3 (3a873f8) will not change coverage.
The diff coverage is 96.90%.

@@            Coverage Diff            @@
##                1.3    #1791   +/-   ##
=========================================
  Coverage     64.64%   64.64%           
+ Complexity     3222     3220    -2     
=========================================
  Files           247      247           
  Lines         17363    17363           
  Branches       3086     3086           
=========================================
  Hits          11225    11225           
  Misses         4590     4590           
  Partials       1548     1548           
Impacted Files Coverage Δ
...byoidc/HTTPJwtKeyByOpenIdConnectAuthenticator.java 94.11% <ø> (ø)
...ic/auth/http/kerberos/HTTPSpnegoAuthenticator.java 0.00% <0.00%> (ø)
...ensearch/security/auditlog/config/AuditConfig.java 98.85% <ø> (ø)
...ssl/transport/SecuritySSLTransportInterceptor.java 0.00% <0.00%> (ø)
...va/org/opensearch/security/support/HTTPHelper.java 84.61% <ø> (ø)
...pensearch/security/securityconf/ConfigModelV6.java 27.49% <66.66%> (ø)
...ic/auth/http/jwt/AbstractHTTPJwtAuthenticator.java 55.81% <100.00%> (ø)
...mazon/dlic/auth/http/jwt/HTTPJwtAuthenticator.java 84.90% <100.00%> (ø)
...azon/dlic/auth/http/jwt/keybyoidc/JwtVerifier.java 85.71% <100.00%> (ø)
.../dlic/auth/http/jwt/keybyoidc/KeySetRetriever.java 76.82% <100.00%> (ø)
... and 90 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a873f8...f9c2f36. Read the comment docs.

@peternied peternied changed the title Switch to log4j logger (#1751) [Backport 1.3] Switch to log4j logger (#1751) Apr 26, 2022
Copy link
Member

@peternied peternied left a comment

Choose a reason for hiding this comment

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

Please merge DarshitChanpura#2 to resolve some files that were missed

@peternied
Copy link
Member

@DarshitChanpura Looks like there is a build issue with the changes

Signed-off-by: Darshit Chanpura <[email protected]>
@DarshitChanpura DarshitChanpura merged commit c6820d1 into opensearch-project:1.3 Apr 28, 2022
@idiaz-at-globant
Copy link

Came here and spent two days figuring out why 1.3.x isn't logging the security plugin.

# rootLogger.level = info
# rootLogger.level = trace
# rootLogger.appenderRef.console.ref = console

# Debug security
logger.securityjwt.name = com.amazon.dlic.auth.http.jwt
logger.securityjwt.level = trace
logger.securityjwt.appenderRef.console.ref = console

I'm not a java expert, assuming you can uncomment the rootLogger

This how this works for me, the documentation doesn't work.

Using helm chats v1.18.0. Hope this help for anyone who came here.

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.

5 participants