~/talk

You are doing logging in .NET wrong. Let’s fix it.

Talkat NDC Oslo 2023 · 2023-05-22..05-26· [dotnet]
slides:none on file

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

  1. 0:00Start
  2. 7:13What is string interpolation?
  3. 11:45Stack
  4. 20:47String interpolation handlers
  5. 30:10What is Log Level?
  6. 35:15Logging source generator
  7. 39:12Create your own handler
  8. 42:32A normal ASP.NET Core request
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.