MINOR: Use parameterized logging in StandardAuthorizer and StandardAuthorizerData (#12192)

This updates StandardAuthorizer and StandardAuthorizerData to use parameterized logging per the SLF4J recommendation (see https://www.slf4j.org/faq.html). This also removes a couple if statements that explicitly check if trace is enabled, but the logger should handle not publishing the message and not constructing the String if trace is not enabled.

Reviewers: Jason Gustafson <jason@confluent.io>
This commit is contained in:
andymg3 2022-05-21 21:14:02 -04:00 committed by GitHub
parent f6ba10ef9c
commit 4878653016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -166,8 +166,7 @@ public class StandardAuthorizer implements ClusterMetadataAuthorizer {
nodeId = -1;
}
this.data = data.copyWithNewConfig(nodeId, superUsers, defaultResult);
this.data.log.info("set super.users=" + String.join(",", superUsers) +
", default result=" + defaultResult);
this.data.log.info("set super.users={}, default result={}", String.join(",", superUsers), defaultResult);
}
// VisibleForTesting

View File

@ -198,7 +198,7 @@ public class StandardAuthorizerData {
for (Entry<Uuid, StandardAcl> entry : aclEntries) {
newData.addAcl(entry.getKey(), entry.getValue());
}
log.info("Applied " + aclEntries.size() + "acl(s) from image.");
log.info("Applied {} acl(s) from image.", aclEntries.size());
return newData;
}
@ -213,9 +213,7 @@ public class StandardAuthorizerData {
throw new RuntimeException("Unable to add the ACL with ID " + id +
" to aclsByResource");
}
if (log.isTraceEnabled()) {
log.trace("Added ACL " + id + ": " + acl);
}
log.trace("Added ACL {}: {}", id, acl);
} catch (Throwable e) {
log.error("addAcl error", e);
throw e;
@ -232,9 +230,7 @@ public class StandardAuthorizerData {
throw new RuntimeException("Unable to remove the ACL with ID " + id +
" from aclsByResource");
}
if (log.isTraceEnabled()) {
log.trace("Removed ACL " + id + ": " + acl);
}
log.trace("Removed ACL {}: {}", id, acl);
} catch (Throwable e) {
log.error("removeAcl error", e);
throw e;