Log buffering in .NET 9 introduces a new approach to logging that temporarily stores logs in memory and allows developers to decide later whether to emit them based on runtime conditions. This feature offers two strategies: global buffering for application-wide control and per-request buffering for HTTP request-scoped control. The technique is particularly valuable for reducing storage costs by only emitting detailed logs when errors occur, while discarding them during successful operations. Developers can configure buffering rules, set memory limits, and trigger log emission through explicit flush operations when specific conditions are met.
Table of contents
The concept: Logs on standby Copy linkTwo powerful buffering strategies Copy linkDynamic configuration updates Copy linkBest practices Copy linkLimitations to be aware of Copy linkPerformance considerations Copy linkSummary Copy linkReferences Copy linkSort: