-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support non-default configuration with Serilog.Settings.Configuration #828
base: main
Are you sure you want to change the base?
Support non-default configuration with Serilog.Settings.Configuration #828
Conversation
Would love to see this get merged soon. We do all of our serilog config through appsettings and I need to use Serilg.Exceptions.EntityFramework to make sure the Entities collection on DbUpdateExceptions aren't serialized 😢 |
@RehanSaeed How about getting this merged? The upstream serilog/serilog-settings-configuration#405 seems to be merged already and this one would be pretty useful as we configure most of Serilog via json to enable specific log features per installation/envionment. |
@RehanSaeed any chance to merge it? |
Would appreciate this change as well. Just spent a decent amount of time trying to figure out how to achieve this |
@RehanSaeed is anything blocking from merging this in, besides the build failure? |
Guess the maintainer lost all interest, as there have been no activity for the past 2 years from the maintainer. Which is a pity as this extension is used quite widely and the bug in question is kinda critical when you work with EF Core, where one needs to add custom destructurers to properly handle Excpetions from DbContext/DbSet/IQueryable objects and currently the only way to configure this is via code, not via json configuration file. |
Sounds like a fork is in order. |
Apologies guys, life got on top of me and I've been unable to keep up with this project. @SimonCropp Do you have bandwidth to help here. |
does anyone on this thread want to add tests for this change? |
I added some test cases. I added dependencies to I used reflection to get to the |
This feature was suggested/requested in closed issues #58 and #300. I too like to configure Serilog using appsettings.json, and this pull request is based on the implementation I currently use. This pull requests adds an overload of
WithExceptionDetails
that builds aDestructuringOptionsBuilder
based on the provided arguments.I did not write test cases for this, since I could not come up with an easy way to do this.
The following example adds a single destructurer on top of the default ones.
The following example adds an extra property filter. Note that this does not work at the moment, because Serilog.Settings.Configuration has problems with arrays inside constructor arguments. I already created a pull request for that at serilog/serilog-settings-configuration#405. When using the changes from that pull request the following will work.
The following example specifies the default configuration explicitly. This is not very useful, except that it shows what all configuration options are.