Skip to content

Fix JSON log parameter ordering - #2506

Draft
Pybsama wants to merge 1 commit into
aws:masterfrom
Pybsama:codex/fix-ilogger-json-state-order
Draft

Fix JSON log parameter ordering#2506
Pybsama wants to merge 1 commit into
aws:masterfrom
Pybsama:codex/fix-ilogger-json-state-order

Conversation

@Pybsama

@Pybsama Pybsama commented Jul 30, 2026

Copy link
Copy Markdown

Issue #, if available:

Fixes #2468

Description of changes:

When the JSON logging path receives a custom ILogger state whose enumeration
order differs from {OriginalFormat}, order the callback arguments by message
template placeholder name instead of by state position.

The implementation:

  • preserves missing placeholder slots and handles duplicate placeholder names;
  • supports destructuring hints, alignment, format specifiers, escaped braces,
    and positional templates;
  • keeps the existing fast path when state is already aligned, and bounds the
    parsed-template cache at 1,024 entries; and
  • adds focused regressions for the ASP.NET Core hosting-log shape and the edge
    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 (20 passed)
  • dotnet test Libraries/test/Amazon.Lambda.Logging.AspNetCore.Tests/Amazon.Lambda.Logging.AspNetCore.Tests.csproj --configuration Release --framework net10.0 (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)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

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.

JSON log format pairs ILogger message template placeholders with state values by position, garbling ASP.NET Core hosting logs

1 participant