A high-performance, zero-allocation .NET logging library for latency-sensitive applications.
ZeroLog is a high-performance logging library for .NET that operates with zero managed heap allocations after initialization. It is designed for latency-sensitive applications where garbage collections are undesirable, ensuring no GC triggers during logging operations. The library uses asynchronous logging to offload formatting and appending to a background thread, minimizing impact on calling threads.
Developers building high-performance .NET applications, such as financial trading systems, real-time data processing, or game servers, where GC pauses must be avoided.
Developers choose ZeroLog for its guaranteed zero-allocation design and asynchronous architecture, which provide predictable performance and eliminate GC-induced latency spikes, unlike traditional logging libraries like log4net or NLog.
A high-performance, zero-allocation .NET logging library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
After initialization, ZeroLog allocates no managed objects on the heap, preventing garbage collections, which is crucial for latency-sensitive applications. The README explicitly states it operates in a 'complete zero-allocation manner.'
All formatting and appending occur in a background thread, minimizing work in calling threads and ensuring high throughput. The README emphasizes that 'no formatting occurs in the calling thread.'
Provides both a string interpolation API using C# 10 handlers and a StringBuilder-like API, offering flexibility for different coding styles. Examples in the README snippets demonstrate both approaches.
Supports appending structured data formatted as JSON via AppendKeyValue, enabling better log analysis. The README includes a code snippet showing how to use this feature.
ZeroLog explicitly does not compete on feature breadth with established libraries like log4net or NLog, missing advanced functionalities such as a wide range of built-in appenders. The README admits it 'won't try to compete on feature set level.'
Version 2 requires .NET 6 and C# 10 or later, which excludes projects on older frameworks, and even the .NET Standard 2.0 target has limited API surface. The README notes this limitation upfront.
Managing log message pools, buffer sizes, and exhaustion strategies adds configuration overhead compared to simpler logging libraries. The README details multiple settings like LogMessagePoolSize and exhaustion strategies that require careful tuning.