From a8039e6659238460edf9bcaf9b808ff3350a3e6c Mon Sep 17 00:00:00 2001 From: papaya2k Date: Tue, 23 Jul 2024 16:27:39 -0400 Subject: [PATCH] Reduce logging level of CACHE_MISS Addresses GitHub Issue #833 by reducing the logging level of a CACHE_MISS in the AuthenticationResultSupplier to debug level. --- .../aad/msal4j/AuthenticationResultSupplier.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultSupplier.java b/msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultSupplier.java index 20d5f07e..1d8d1a43 100644 --- a/msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultSupplier.java +++ b/msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultSupplier.java @@ -95,10 +95,17 @@ public IAuthenticationResult get() { msalRequest.requestContext().correlationId(), error); - clientApplication.log.warn( - LogHelper.createMessage( - String.format("Execution of %s failed: %s", this.getClass(), ex.getMessage()), - msalRequest.headers().getHeaderCorrelationIdValue())); + String logMessage = LogHelper.createMessage( + String.format("Execution of %s failed: %s", this.getClass(), ex.getMessage()), + msalRequest.headers().getHeaderCorrelationIdValue()); + if (ex instanceof MsalClientException) { + MsalClientException exception = (MsalClientException) ex; + if (exception.errorCode() != null && exception.errorCode().equalsIgnoreCase(AuthenticationErrorCode.CACHE_MISS)) { + clientApplication.log.debug(logMessage); + } + } else { + clientApplication.log.warn(logMessage); + } throw new CompletionException(ex); }