Skip to content

Modernize structured logging and redact HTTP request/response logs - #1338

Closed
StuartFerguson wants to merge 12 commits into
mainfrom
feature/#1337_modernize_structured_logging
Closed

StuartFerguson wants to merge 12 commits into
mainfrom
feature/#1337_modernize_structured_logging

Conversation

@StuartFerguson

Copy link
Copy Markdown
Member

Summary

  • Add structured message-template logging and event metadata to Shared.Logger.
  • Emit tenant, correlation, and trace context through NLog.
  • Add configurable request/response logging with sensitive-data redaction and bounded body capture.
  • Include a sample project and regression tests.

Verification

  • dotnet test Shared.Tests/Shared.Tests.csproj --no-restore — 302 passed.

Closes #1337

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T14:39:24.232721Z 576dfb2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 576dfb22c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@codacy-production

codacy-production Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 critical · 8 medium

Alerts:
⚠ 10 issues (≤ 0 issues of at least medium severity)

Results:
10 new issues

Category Results
BestPractice 8 medium
ErrorProne 1 critical
Complexity 1 critical

View in Codacy

🟢 Metrics 137 complexity · -1 duplication

Metric Results
Complexity 137
Duplication -1

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Comment thread Shared.Logger/NlogLogger.cs Dismissed
Comment thread Shared.Tests/StructuredLoggingTests.cs Dismissed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
StuartFerguson and others added 4 commits October 23, 2026 15:56
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
StuartFerguson and others added 4 commits October 23, 2026 16:25
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread Shared.Logger/Logger.cs Fixed
StuartFerguson and others added 2 commits October 23, 2026 16:40
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…from user input'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs Fixed
Comment thread Shared.Logger/Logger.cs
params Object?[] args)
{
Logger.ValidateLoggerObject();
Logger.Write((logger, sanitizedArgs) => logger.LogError(messageTemplate, sanitizedArgs), true, args);
Comment thread Shared.Logger/Logger.cs Resolved
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Comment thread Shared.Logger/Logger.cs
{
Logger.ValidateLoggerObject();
String sanitizedTemplate = Logger.SanitizeForLog(messageTemplate);
Logger.Write((logger, sanitizedArgs) => logger.LogTrace(sanitizedTemplate, sanitizedArgs), true, args);
Comment thread Shared.Logger/Logger.cs
{
Logger.ValidateLoggerObject();
String sanitizedTemplate = Logger.SanitizeForLog(messageTemplate);
Logger.Write((logger, sanitizedArgs) => logger.LogDebug(sanitizedTemplate, sanitizedArgs), true, args);
Comment thread Shared.Logger/Logger.cs
{
Logger.ValidateLoggerObject();
String sanitizedTemplate = Logger.SanitizeForLog(messageTemplate);
Logger.Write((logger, sanitizedArgs) => logger.LogInformation(sanitizedTemplate, sanitizedArgs), true, args);
Comment thread Shared.Logger/Logger.cs
{
Logger.ValidateLoggerObject();
String sanitizedTemplate = Logger.SanitizeForLog(messageTemplate);
Logger.Write((logger, sanitizedArgs) => logger.LogWarning(sanitizedTemplate, sanitizedArgs), true, args);
@StuartFerguson
StuartFerguson deleted the feature/#1337_modernize_structured_logging branch October 23, 2026 15:59
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.

Modernize structured logging and redact HTTP request/response logs

2 participants