~/talk

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

Talkat dotnetdays 2023 · 2023-06-01..06-02· [dotnet]
slides:none on file

Logging uses the message literal as a message template not an interpolated string; string interpolation or concatenation causes boxing and many heap string allocations that trigger GC pauses (demonstrated as spikes around ~16MB). Use structured logging with named parameters so paymentId and status are indexed separately, push templates once, and search by fields. Prefer Serilog or C# 10+ interpolation handlers and source-generated loggers to avoid runtime boxing and redundant allocations, keeping logs laconic and consistent.

AI-written summary · about

  1. 0:00Introduction and talk setup
  2. 2:51Why logging matters to everyone
  3. 5:19Logging rule one: message templates
  4. 10:14Memory management in .NET
  5. 24:25Logging rule two: avoid string interpolation
  6. 24:50Structured logging explained
  7. 30:08Logging rule three: parameter naming
  8. 33:20Understanding log levels
  9. 37:09Source generators for logging
  10. 41:45Custom string interpolation handlers
  11. 45:16Performance vs correctness in logging
  12. 47:04Why we log: telling a story
  13. 51:01Summary and Q&A
~/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.