Skip to content

Commit 361ec5f

Browse files
committed
Reduce logging level of CACHE_MISS <GitHub Issue #833>
Addresses GitHub Issue #833 by reducing the logging level of a CACHE_MISS in the AuthenticationResultSupplier to debug level.
1 parent c83185c commit 361ec5f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

msal4j-sdk/src/main/java/com/microsoft/aad/msal4j/AuthenticationResultSupplier.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,17 @@ public IAuthenticationResult get() {
9595
msalRequest.requestContext().correlationId(),
9696
error);
9797

98-
clientApplication.log.warn(
99-
LogHelper.createMessage(
100-
String.format("Execution of %s failed: %s", this.getClass(), ex.getMessage()),
101-
msalRequest.headers().getHeaderCorrelationIdValue()));
98+
String logMessage = LogHelper.createMessage(
99+
String.format("Execution of %s failed: %s", this.getClass(), ex.getMessage()),
100+
msalRequest.headers().getHeaderCorrelationIdValue());
101+
if (ex instanceof MsalClientException) {
102+
MsalClientException exception = (MsalClientException) ex;
103+
if (exception.errorCode() != null && exception.errorCode().equalsIgnoreCase(AuthenticationErrorCode.CACHE_MISS)) {
104+
clientApplication.log.debug(logMessage);
105+
}
106+
} else {
107+
clientApplication.log.warn(logMessage);
108+
}
102109

103110
throw new CompletionException(ex);
104111
}

0 commit comments

Comments
 (0)