Fix JSON log parameter ordering - #2506
Conversation
|
Reporter of #2468 here. The approach looks right, two practical notes:
Also worth knowing: #2474 inserts a block immediately before the |
|
Thanks for both notes. I checked them against the current repository state: #2545 retired the |
There was a problem hiding this comment.
Pull request overview
Fixes JSON structured logging by aligning custom ILogger state values with template placeholders.
Changes:
- Adds name-based parameter ordering and template parsing.
- Adds regression and edge-case tests.
- Adds an AutoVer patch entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
LambdaILogger.cs |
Implements parameter reordering and parsing. |
LoggingTests.cs |
Tests ordering and template edge cases. |
.autover/changes/58593c38-0c20-4fee-993c-15ea9f1f49fb.json |
Records the patch change. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (UsesPositionalArguments(templateProperties)) | ||
| { | ||
| return GetPropertyValues(properties); | ||
| } |
Issue #, if available:
Fixes #2468
Description of changes:
When the JSON logging path receives a custom
ILoggerstate whose enumerationorder differs from
{OriginalFormat}, order the callback arguments by messagetemplate placeholder name instead of by state position.
The implementation:
and positional templates;
1,024-entry soft cache cap as RuntimeSupport; and
cases above, plus the required AutoVer patch change file.
Validation:
dotnet test Libraries/test/Amazon.Lambda.Logging.AspNetCore.Tests/Amazon.Lambda.Logging.AspNetCore.Tests.csproj --framework net10.0 --configuration Debug(20 passed)dotnet test Libraries/test/Amazon.Lambda.Logging.AspNetCore.Tests/Amazon.Lambda.Logging.AspNetCore.Tests.csproj --framework net10.0 --configuration Release(20 passed)dotnet build Libraries/test/Amazon.Lambda.Logging.AspNetCore.Tests/Amazon.Lambda.Logging.AspNetCore.Tests.csproj --configuration Release --framework net8.0(0 warnings, 0 errors)master(fdb84c71)git -c core.whitespace=cr-at-eol diff --checkBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.