Skip to content

fix(serilog): set category.name for structured logs from SourceContext#5396

Closed
Shaurya2k06 wants to merge 1 commit into
getsentry:mainfrom
Shaurya2k06:fix/serilog-structured-category-name
Closed

fix(serilog): set category.name for structured logs from SourceContext#5396
Shaurya2k06 wants to merge 1 commit into
getsentry:mainfrom
Shaurya2k06:fix/serilog-structured-category-name

Conversation

@Shaurya2k06

@Shaurya2k06 Shaurya2k06 commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Serilog structured logs captured via EnableLogs now set category.name from Serilog SourceContext when present. This matches MEL structured logging and Serilog's event path (SentryEvent.Logger).

Why

Without category.name, Serilog structured logs lose the canonical source identifier used for filtering and correlation. The identifier currently appears only as property.SourceContext (when present), not as the standard log category attribute.

Context

Mirrors the NLog structured logging fix in #5176, which sets category.name from the logger name. The Serilog change was intentionally kept out of that PR to keep it scoped to NLog.

Verification

Added Serilog structured logging tests asserting category.name is set when SourceContext is present and absent when it is not.

Issues

Closes #5390

@Shaurya2k06
Shaurya2k06 force-pushed the fix/serilog-structured-category-name branch from 4e90735 to acd6f91 Compare July 16, 2026 08:08
Serilog structured logs captured via EnableLogs now set the canonical
category.name attribute from SourceContext when present, matching MEL and
the Serilog event path.

Signed-off-by: shaurya2k06 <shaurya2k06@gmail.com>
@Shaurya2k06
Shaurya2k06 force-pushed the fix/serilog-structured-category-name branch from acd6f91 to 7e008f0 Compare July 16, 2026 08:09
@Shaurya2k06
Shaurya2k06 marked this pull request as ready for review July 16, 2026 08:09
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serilog structured logs omit logger name (category.name)

1 participant