Skip to content

Reduce equal method candidates log from WARNING to FINE#2954

Open
gnodet wants to merge 2 commits intomainfrom
fix/reduce-equal-candidates-log-level
Open

Reduce equal method candidates log from WARNING to FINE#2954
gnodet wants to merge 2 commits intomainfrom
fix/reduce-equal-candidates-log-level

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 12, 2026

Summary

  • Downgrades the "Both X and Y are equal candidates for handling the current request" log message from WARNING to FINE (debug) level in OperationResourceInfoComparatorBase
  • This message fires during normal CORS preflight handling where CrossOriginResourceSharingFilter.findPreflightMethod() uses MediaType.WILDCARD, causing all methods on the same path to match equally
  • The behavior is deterministic (stable sort order) so the warning is misleading — it says "unpredictable results" but the results are actually predictable
  • Users debugging ambiguous routing can still see this message by enabling FINE logging

Supersedes #862 with a simpler fix — rather than changing the CORS filter to pass real media types, we simply reduce the noise level of a message that fires in expected scenarios.

Test plan

  • Compiles cleanly
  • CI verification

🤖 Generated with Claude Code

The "Both X and Y are equal candidates" message fires during normal
CORS preflight handling where wildcard media types are used, producing
noisy logs. Downgrade to FINE since the behavior is deterministic and
users can enable debug logging to investigate ambiguous routing.

Closes #862

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop misleading "unpredictable results" phrasing (the sort is stable)
and use a lambda supplier to avoid string concatenation overhead when
FINE logging is disabled.

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

@ffang ffang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gnodet !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants