[ https://issues.apache.org/jira/browse/KAFKA-7478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16642504#comment-16642504 ]
ASF GitHub Bot commented on KAFKA-7478: --------------------------------------- rajinisivaram closed pull request #5738: KAFKA-7478: Reduce default logging verbosity in OAuthBearerLoginModule URL: https://github.com/apache/kafka/pull/5738 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/OAuthBearerLoginModule.java b/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/OAuthBearerLoginModule.java index e3a78103560..e7976b55506 100644 --- a/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/OAuthBearerLoginModule.java +++ b/clients/src/main/java/org/apache/kafka/common/security/oauthbearer/OAuthBearerLoginModule.java @@ -305,7 +305,7 @@ public boolean login() throws LoginException { log.debug("Logged in without a token, this login cannot be used to establish client connections"); loginState = LoginState.LOGGED_IN_NOT_COMMITTED; - log.info("Login succeeded; invoke commit() to commit it; current committed token count={}", + log.debug("Login succeeded; invoke commit() to commit it; current committed token count={}", committedTokenCount()); return true; } @@ -340,7 +340,7 @@ private void identifyExtensions() throws LoginException { throw new LoginException("An internal error occurred while retrieving SASL extensions from callback handler"); } catch (UnsupportedCallbackException e) { extensionsRequiringCommit = EMPTY_EXTENSIONS; - log.info("CallbackHandler {} does not support SASL extensions. No extensions will be added", callbackHandler.getClass().getName()); + log.debug("CallbackHandler {} does not support SASL extensions. No extensions will be added", callbackHandler.getClass().getName()); } if (extensionsRequiringCommit == null) { log.error("SASL Extensions cannot be null. Check whether your callback handler is explicitly setting them as null."); @@ -354,12 +354,11 @@ public boolean logout() { throw new IllegalStateException( "Cannot call logout() immediately after login(); need to first invoke commit() or abort()"); if (loginState != LoginState.COMMITTED) { - if (log.isDebugEnabled()) - log.debug("Nothing here to log out"); + log.debug("Nothing here to log out"); return false; } if (myCommittedToken != null) { - log.info("Logging out my token; current committed token count = {}", committedTokenCount()); + log.trace("Logging out my token; current committed token count = {}", committedTokenCount()); for (Iterator<Object> iterator = subject.getPrivateCredentials().iterator(); iterator.hasNext(); ) { Object privateCredential = iterator.next(); if (privateCredential == myCommittedToken) { @@ -368,15 +367,15 @@ public boolean logout() { break; } } - log.info("Done logging out my token; committed token count is now {}", committedTokenCount()); + log.debug("Done logging out my token; committed token count is now {}", committedTokenCount()); } else log.debug("No tokens to logout for this login"); if (myCommittedExtensions != null) { - log.info("Logging out my extensions"); + log.trace("Logging out my extensions"); if (subject.getPublicCredentials().removeIf(e -> myCommittedExtensions == e)) myCommittedExtensions = null; - log.info("Done logging out my extensions"); + log.debug("Done logging out my extensions"); } else log.debug("No extensions to logout for this login"); @@ -387,17 +386,16 @@ public boolean logout() { @Override public boolean commit() { if (loginState != LoginState.LOGGED_IN_NOT_COMMITTED) { - if (log.isDebugEnabled()) - log.debug("Nothing here to commit"); + log.debug("Nothing here to commit"); return false; } if (tokenRequiringCommit != null) { - log.info("Committing my token; current committed token count = {}", committedTokenCount()); + log.trace("Committing my token; current committed token count = {}", committedTokenCount()); subject.getPrivateCredentials().add(tokenRequiringCommit); myCommittedToken = tokenRequiringCommit; tokenRequiringCommit = null; - log.info("Done committing my token; committed token count is now {}", committedTokenCount()); + log.debug("Done committing my token; committed token count is now {}", committedTokenCount()); } else log.debug("No tokens to commit, this login cannot be used to establish client connections"); @@ -414,7 +412,7 @@ public boolean commit() { @Override public boolean abort() { if (loginState == LoginState.LOGGED_IN_NOT_COMMITTED) { - log.info("Login aborted"); + log.debug("Login aborted"); tokenRequiringCommit = null; extensionsRequiringCommit = null; loginState = LoginState.NOT_LOGGED_IN; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Reduce OAuthBearerLoginModule verbosity > --------------------------------------- > > Key: KAFKA-7478 > URL: https://issues.apache.org/jira/browse/KAFKA-7478 > Project: Kafka > Issue Type: Improvement > Reporter: Stanislav Kozlovski > Assignee: Stanislav Kozlovski > Priority: Minor > > The OAuthBearerLoginModule is pretty verbose by default and this fills logs > in with too much information. It would be nice if we could reduce the > verbosity by default and let the user opt in to inspect these debug-friendly > messages > {code:java} > [INFO] 2018-10-03 16:58:11,986 [qtp1137078855-1798] > org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule login - > Login succeeded; invoke commit() to commit it; current committed token > count=0 > [INFO] 2018-10-03 16:58:11,986 [qtp1137078855-1798] > org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule commit - > Committing my token; current committed token count = 0 > [INFO] 2018-10-03 16:58:11,986 [qtp1137078855-1798] > org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule commit - > Done committing my token; committed token count is now 1 > [INFO] 2018-10-03 16:58:11,986 [qtp1137078855-1798] > org.apache.kafka.common.security.oauthbearer.internals.expiring.ExpiringCredentialRefreshingLogin > login - Successfully logged in. > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)