A Serilog enricher that logs exception details and custom properties not included in Exception.ToString().
Serilog.Exceptions is a Serilog enricher library for .NET that captures and logs detailed exception information and custom properties not included in the standard `Exception.ToString()` output. It solves the problem of missing critical debugging data in structured logs, such as nested validation errors in Entity Framework exceptions. By providing deep destructuring of exceptions, it ensures developers have complete visibility into failures.
.NET developers using Serilog for structured logging who need comprehensive exception details for debugging complex applications, particularly those working with databases, web APIs, or microservices.
Developers choose Serilog.Exceptions because it fills a critical gap in Serilog's default logging by extracting hidden exception properties essential for debugging, does so with minimal performance impact using optimized destructurers, and offers extensibility for custom and third-party exceptions through a modular package ecosystem.
Log exception details and custom properties that are not output in Exception.ToString().
Logs nested custom properties from exceptions like DbEntityValidationException that are missing from standard ToString(), as shown in the README's JSON example with EntityValidationErrors.
Uses custom destructurers for common exception types to minimize reflection overhead, falling back only for unsupported types, with reflection operations cached per exception-type.
Supports custom destructurers for user-defined exceptions and offers additional NuGet packages for libraries like Entity Framework Core, SQL Server, and gRPC to avoid reflection.
Allows filtering of properties like StackTrace and TargetSite to avoid duplication or sensitive data logging, using built-in or custom IExceptionPropertyFilter implementations.
The README warns that without proper configuration, Entity Framework exceptions can log entire database schemas (e.g., via IQueryable properties), posing a security risk that requires additional destructurers to mitigate.
Optimal performance requires installing separate NuGet packages for specific exception types (e.g., Serilog.Exceptions.EntityFrameworkCore), adding to project complexity and maintenance.
Setting up sinks to output enriched properties (e.g., adding {Properties:j} to templates) and configuring destructurers involves extra steps beyond basic Serilog setup, which can be error-prone.
Simple .NET logging with fully-structured events
NLog - Flexible and Structured Logging for various .NET Platforms
Serilog integration for ASP.NET Core
Apache Log4net is a versatile, feature-rich, efficient logging API and backend for .NET
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.