Mert Özen Further With Every Line

Blog

Mert Özen's blog posts on software development, backend, frontend, and DevOps.

Series
8 posts found #serilog
What's New in Logging from .NET 8 to .NET 11: Enrichment, Redaction, FakeLogger, Buffering and Generic LoggerMessage
Backend PART 10

What's New in Logging from .NET 8 to .NET 11: Enrichment, Redaction, FakeLogger, Buffering and Generic LoggerMessage

Logging in .NET moves on two trains: ILogger and the source generator ship with the runtime, while enrichment, redaction, FakeLogger, sampling and buffering come with the monthly Microsoft.Extensions.Telemetry packages. With real output we show which feature arrived when, CA1873 and the obsolete AddServiceLogEnricher in .NET 10, generic LoggerMessage in .NET 11, and how to read old Serilog Startup code.

8 Nov 2026 12 min 4
Log Levels and Cost: Sampling, Buffering and Changing Log Levels Live in Production
Backend PART 09

Log Levels and Cost: Sampling, Buffering and Changing Log Levels Live in Production

Log volume is set by your level configuration: the same 1000 requests produced 6.3 MB of logs at Debug and 246 KB at Information with Microsoft.AspNetCore=Warning. With real output we show random and trace-based sampling in Microsoft.Extensions.Telemetry, per-request buffering that writes Debug logs on failure, changing levels without a restart, and how sampling can drop Errors and buffers lose scopes and TraceId.

8 Nov 2026 12 min 4
Sensitive Data in Logs: Redaction, Data Classification and Privacy-Compliant Logging
Backend PART 07

Sensitive Data in Logs: Redaction, Data Classification and Privacy-Compliant Logging

The way to keep sensitive data out of logs is to classify it and mask it automatically in the logging pipeline. Taxonomy and attributes with Microsoft.Extensions.Compliance.Redaction, [LogProperties], ErasingRedactor, your own redactor and the HMAC redactor that keeps correlation; masking with destructuring in Serilog, personal data in exception messages and a FakeLogger test that catches it, with real output.

8 Nov 2026 11 min 4
Correlation IDs and Trace Context: Linking Every Log of a Request from the API to the Queue
Backend PART 06

Correlation IDs and Trace Context: Linking Every Log of a Request from the API to the Queue

The way to link every log of a request is to write the TraceId from the W3C traceparent on every log line. ASP.NET Core and HttpClient do it on their own; across a queue and a BackgroundService the chain breaks and must be carried manually with DistributedContextPropagator. ActivityTrackingOptions, Serilog, baggage, X-Correlation-ID, a support code on the error screen and one Seq query, with real output.

8 Nov 2026 10 min 5
Reading Structured Logs with Seq: Docker Setup, Queries, Signals and Alerts
Backend PART 05

Reading Structured Logs with Seq: Docker Setup, Queries, Signals and Alerts

We run Seq in Docker with a password and a separate ingestion port, and send logs through Serilog and OTLP with an Ingest-only API key. Filters, group by and percentile queries, logs and spans on the same TraceId, signals, alerts and signal-based retention, all with real results, including why 8 failures became 16 events and the ERROR level trap with OTLP.

8 Nov 2026 12 min 5
Serilog Sinks: Console, File, Seq and OpenTelemetry — Async, Batching and Lost Logs
Backend PART 04

Serilog Sinks: Console, File, Seq and OpenTelemetry — Async, Batching and Lost Logs

In a container, logs go to stdout as compact JSON; if you need files, set rolling and retention explicitly. Serilog 4's core batching and the async wrapper either drop events or hold the app when a sink is slow: 101 of 2,000 events arrived, or the loop took 2.4 seconds. SelfLog, going out to OTLP and per-sink levels.

8 Nov 2026 11 min 5
Serilog in Depth: Bootstrap Logger, appsettings Configuration, Enrichers and Request Logging
Backend PART 03

Serilog in Depth: Bootstrap Logger, appsettings Configuration, Enrichers and Request Logging

A production-ready Serilog setup has two stages: a bootstrap logger that catches startup failures, then the real logger fed by appsettings and DI. ReadFrom.Configuration, a custom enricher, PushProperty versus BeginScope, UseSerilogRequestLogging writing one summary event per request, and the logs lost when CloseAndFlush is forgotten.

8 Nov 2026 12 min 4
Logging in ASP.NET Core: ILogger, Log Levels, Structured Logging and Serilog
Backend PART 13

Logging in ASP.NET Core: ILogger, Log Levels, Structured Logging and Serilog

We write logs with ILogger<T> in ASP.NET Core: categories, log levels, filters via appsettings and environment variables, structured logging with message templates, scopes, the LoggerMessage source generator and the Serilog version that supports net6.0.

4 Nov 2026 8 min 32
Blog Map