Serilog.Exceptions.EntityFrameworkCore docs warning unclear
samcarton opened this issue · 1 comments
Describe the bug
This warning in the docs makes it sound like you don't need to use Serilog.Exceptions.EntityFrameworkCore
at all if you are using Serilog.Exceptions
8.0.0 or above :
WARNING: In versions of Serilog.Exceptions older than 8.0.0, if you are using EntityFrameworkCore with Serilog.Exceptions you must add this, otherwise in certain cases your entire database will be logged! This is because the exceptions in Entity Framework Core have properties that link to the entire database schema in them (See #100, dotnet/efcore#15214). Newer versions of Serilog.Exceptions avoids this issue by preventing the destructure of properties that implement IQueryable preventing their execution.
The issue is that the fix in Serilog.Exceptions
8.0.0 only stops the IQueryable
properties from being evaluated, but the rest of the DbContext
still gets logged out. For large DbContexts
this amounts to a large amount of useless info polluting the logs. It may be worth mentioning that there is still value in using Serilog.Exceptions.EntityFrameworkCore
alongside SerilogExceptions
>8.0.0.
Steps to reproduce
- Don't use
Serilog.Exceptions.EntityFrameworkCore
- Use
Serilog.Exceptions
8.0.0 or above. - Still get your entire
DbContext
logged out inDbUpdateException
s (minusIQueryable
evaluation).
Expected behaviour
The docs aren't clear that there is still benefit to using Serilog.Exceptions.EntityFrameworkCore
Thanks. Now fixed.