Downgrade 4 ATM user token log messages from Error to Warning - #317
Conversation
There was a problem hiding this comment.
Pull request overview
Downgrades several user-token lifecycle log events in Duende.AccessTokenManagement.OpenIdConnect from LogLevel.Error to LogLevel.Warning to avoid production alert noise for expected session/refresh-token scenarios.
Changes:
- Downgraded “no active user” log from Error to Warning when the user is unauthenticated.
- Downgraded “missing tokens in cookie/properties” log from Error to Warning.
- Downgraded refresh-token refresh/revoke failure logs from Error to Warning.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| access-token-management/src/AccessTokenManagement.OpenIdConnect/Internal/UserAccessTokenManagementService.cs | Downgrades unauthenticated-user access token retrieval log to Warning. |
| access-token-management/src/AccessTokenManagement.OpenIdConnect/Internal/StoreTokensInAuthenticationProperties.cs | Downgrades missing-cookie-token log to Warning for common session-expiry scenarios. |
| access-token-management/src/AccessTokenManagement.OpenIdConnect/Internal/OpenIdConnectUserTokenEndpoint.cs | Downgrades refresh/revoke error logs to Warning for expected token lifecycle outcomes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I think some of these are expected and should go down to info level. |
There was a problem hiding this comment.
These downgrading of log messages does make sense. None of the messages that were previously error messages would require or warrant an alert being raised and would likely just lead to Alert fatigue.
I do however agree with @josephdecock. We could we revise these and determine whether we should further downgrade them from Warning to Information.
2d00223 to
e58b816
Compare
|
Given "These conditions represent normal authentication lifecycle events" I'm also in support of downgrading to info. That was my initial reaction when I first saw this, before I saw the comments above. |
|
Will need a second PR targetting |
Suggestion: Split log levels — 2 to Information, 2 stay at WarningAfter reviewing the four log messages, I think we should differentiate based on whether the failure involves an external call: Downgrade to
|
These conditions represent normal authentication lifecycle events (expired sessions, expired refresh tokens) rather than application errors. Logging them at Error triggers unnecessary production alerts that users cannot selectively filter without also suppressing genuine errors. Resolves DuendeSoftware/issues#1229
CannotRetrieveAccessTokenDueToNoActiveUser and FailedToGetUserTokenDueToMissingTokensInCookie are purely local state checks (unauthenticated user, missing cookie tokens) that are expected during normal session expiry. Information is the appropriate level. FailedToRefreshAccessToken and FailedToRevokeAccessToken remain at Warning since they represent failed external HTTP calls where a spike could indicate infrastructure problems.
be46b2d to
90e9ce9
Compare
|
I don't see these changes in the 4.2.0 release from Mar 18, when can we expect this in a Nuget release? |
Summary
Downgrades 4 log messages in
Duende.AccessTokenManagement.OpenIdConnectfromLogLevel.ErrortoLogLevel.Warning. These conditions represent normal authentication lifecycle events (expired sessions, expired refresh tokens) rather than application errors.Related: DuendeSoftware/products-private#2505
Problem
Users report that these Error-level log messages trigger unnecessary production alerts. They cannot selectively filter them because turning off all errors in the
Duendenamespace would also hide genuine errors.Changes
UserAccessTokenManagementService.cs:39CannotRetrieveAccessTokenDueToNoActiveUseruser.Identity.IsAuthenticatedis false — expected when session expiresStoreTokensInAuthenticationProperties.cs:53FailedToGetUserTokenDueToMissingTokensInCookieOpenIdConnectUserTokenEndpoint.cs:132FailedToRefreshAccessTokenOpenIdConnectUserTokenEndpoint.cs:212FailedToRevokeAccessTokenWhat stays at Error
FailedToRequestAccessTokenForClient(client credentials) remains atLogLevel.Error— client credentials failures are not related to user session lifecycle and could indicate genuine infrastructure problems.Consistency
This also resolves a log level inconsistency in the pipeline:
Information→Error→WarningInformation→Warning→Warning