You are doing logging in .NET wrong. Let’s fix it.
summary
Asserts that the text passed to logging APIs is a message template, not a preformatted string; using string interpolation or concatenation creates heap string allocations and boxed parameter arrays that drive GC pauses. Recommends structural logging (Serilog/ILogger templates, Application Insights dimensions) and using Microsoft’s LoggerMessage source generators or C#10 interpolation handlers to avoid boxing by generating struct/generic log values. Advises defaulting Microsoft.AspNetCore logging to warning in production, profiling with JetBrains dotMemory, and logging only the minimal named parameters needed to tell the failure story.
AI-written summary · about
chapters (8)
- 0:00Start
- 7:13What is string interpolation?
- 11:45Stack
- 20:47String interpolation handlers
- 30:10What is Log Level?
- 35:15Logging source generator
- 39:12Create your own handler
- 42:32A normal ASP.NET Core request
related talks
51mYou are doing logging in .NET wrong. Let’s fix it.
01h 02mPatterns for application development with ASP.NET Core
53m.NET:Stay calm and Serilog + Elastic Search + Kibana on .NET Core
31mSmall things we got wrong in .NET
01h 02mAbusing C# More
01h 05mCorrecting Common Async/Await Mistakes in .NET 10
56mAn Opinionated Approach to ASP.NET Core
01h 05mLook Mommy, No GC!
