Skip to content

chore: reduce verbose logging for successful token validation#1763

Open
olebhansen wants to merge 1 commit intoAltinn:mainfrom
olebhansen:feature/1215-reduce-verbose-logging
Open

chore: reduce verbose logging for successful token validation#1763
olebhansen wants to merge 1 commit intoAltinn:mainfrom
olebhansen:feature/1215-reduce-verbose-logging

Conversation

@olebhansen
Copy link

@olebhansen olebhansen commented Jan 9, 2026

Summary

This PR changes the log level for "Successfully validated the token." message from LogInformation to LogDebug.

Background

As part of work to reduce excessive logging in Altinn Notifications (see altinn-notifications#1215), we identified that the Notifications services were generating millions of log entries. The main changes were made in:

After deploying those changes, we observed that the "Successfully validated the token." message is still being logged at high volume. This message is logged for every successfully authenticated request, which generates significant log volume in production.

Rationale

  • Current behavior: Logs at Information level for every successful token validation
  • Problem: High-frequency log entry that provides limited operational value - success is the expected path
  • Solution: Change to Debug level so it's available when needed but doesn't flood production logs

Logging successful validations at Information level is unusual - typically only failures or warnings warrant this level. The authentication failure paths already log appropriately at Information level, which is more useful for troubleshooting.

Changes

  • JwtCookieHandler.cs: Changed LogInformation to LogDebug for "Successfully validated the token." message (line 225)

Test plan

  • Verify build passes
  • Verify existing tests pass
  • Deploy to test environment and verify reduced log volume

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Adjusted logging verbosity for token validation operations to reduce noise in standard logs.

✏️ Tip: You can customize this high-level summary in your review settings.

Change LogInformation to LogDebug for "Successfully validated the token."
message. This log entry is generated for every authenticated request and
contributes to excessive log volume in production environments.

Related to: Altinn/altinn-notifications#1215

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 9, 2026

📝 Walkthrough

Walkthrough

Adjusted logging verbosity in JWT token validation by changing the success message log level from Information to Debug. No modifications to authentication logic or error handling; only the output verbosity is affected.

Changes

Cohort / File(s) Summary
Logging Configuration
src/jwtcookie/Authentication/JwtCookie/JwtCookieHandler.cs
Changed log level for successful token validation from Information to Debug, reducing console output verbosity for routine validation success events

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and clearly describes the main change: reducing log verbosity for successful token validation by changing the log level from Information to Debug.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f1e2a49 and d714207.

📒 Files selected for processing (1)
  • src/jwtcookie/Authentication/JwtCookie/JwtCookieHandler.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build and Test
🔇 Additional comments (1)
src/jwtcookie/Authentication/JwtCookie/JwtCookieHandler.cs (1)

225-225: LGTM! Appropriate log level reduction.

The change from LogInformation to LogDebug is well-justified. Successful token validations occur on every authenticated request and produce excessive log volume in production. Debug level allows this message to be available when needed for troubleshooting while keeping production logs focused on actionable events.

The logging hierarchy is now sensible: failures remain at Information level (lines 201, 244) for visibility, while routine successes are demoted to Debug.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@olebhansen olebhansen marked this pull request as ready for review January 16, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants