Skip to content

EF Core DbUpdateException logging issue appsettings configuration capability #957

@RickBogard

Description

@RickBogard

Describe the bug

When using the appsettings.json configuration
"Enrich": [
"WithExceptionDetails"
],
for serilog, I get messages that the Max Destructuring Deepth has been reached and all my DbContext objects are logged. I see there is a fix for this by using the fluent api to specify the Enrichment with custom destructurer. Is there a way to use the config file to do the same configuration?
Reference bug where this fix was implemented: Entity Framework Logging Behaviour #439 . Note that when I have the code in my program.cs to initialize the log, it is overridden by the appsettings.json and the issues of logging the whole DbContext still occurs.

Steps to reproduce

  1. Set up serilog logging
  2. Set up Destructure Enrichment with .Net 8 libraries
  3. Set up appsettings.json with Serilog Enrich section using "WithExceptionDetails"
  4. Generate DbUpdateException
  5. Observer the entire DbContext (all tables) are logged

Expected behaviour

Is there some way to configure the Enriched log WithExceptionDetails fully in the appsettings configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues describing a bug or pull requests fixing a bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions