Comments (13)
Took me a while to understand what is happening and I found out that this particular exception somehow declares property Content
twice. Serilog.Exceptions
fails silently in this case so you do not get any enrichment.
I will fix it tomorrow and let you know.
from serilog.exceptions.
I am using Serilog.Exceptions with ApplicationInsights sink and it works fine.
You need to provide an example https://stackoverflow.com/help/minimal-reproducible-example
, for us to check.
Moreover, Serilog.Exceptions is basically unrelated to any particular sink, its code is executed before sink code obviously.
from serilog.exceptions.
Yea, my bad, it seems that issue is with Refit.ValidationApiException. It's not getting deconstructed. I'll try to create an example
from serilog.exceptions.
I'm having trouble finding a public API that will return that exception.
In this repo everything works when ApiException is caught, but if ValidationApiException is caught then nothing gets deconstructed, not even properties from the base ApiException class.
I'll try to find a public API that throws ValidationApiException but at the moment this is the best I could come up with.
In the meantime I changed my code to serialize Content manually and log it.
catch (ValidationApiException apiException)
{
var validationError = JsonSerializer.Serialize(apiException.Content);
_logger.LogError(apiException, "Validation error occured while calling external API {validationError}", validationError);
}
https://github.com/domagojmedo/LoggingExample
from serilog.exceptions.
You don't need public API, just create exception manually then log it and verify result in the log output.
from serilog.exceptions.
I tried but had issues because it required APiException in constructor. Switched to using reflection now.
Repo is updated, you can see that Content is set to some ProblemDetails object, but nothing is output in console.
If you uncomment ThrowApiException and comment that method you will see that it works as intended
from serilog.exceptions.
Ok, it just overrides the definition of Content
with new
keyword.
from serilog.exceptions.
If someone has used the new
keyword on a property, they are deliberately hiding the one the base class. I'm not really sure we should we be retrieving both. In this case, the derived class looks like it gives us a better representation of the content (ProblemDetails
) than the base class (String
). Thoughts @krajek?
from serilog.exceptions.
@RehanSaeed yes, agreed 100%, next PR will tackle that problem.
Just to reiterate: this PR is just a safety mechanism, the last line of defense, but not the only one.
I assume that robustness(meaning in that case "providing value to the library user" even in the unexpected scenario) is so important for our library that such a mechanism is justifiable.
I will start the next PR just after this is merged.
from serilog.exceptions.
@RehanSaeed when can we expect new version with this fix?
from serilog.exceptions.
@krajek Do you want to put in another PR with further improvements? E.g. using ConcurrentDictionary
?
from serilog.exceptions.
from serilog.exceptions.
Released in https://github.com/RehanSaeed/Serilog.Exceptions/releases/tag/7.0.0
from serilog.exceptions.
Related Issues (20)
- Add configuration example to readme HOT 1
- Separated Column or Porperty for exception stacktrace HOT 2
- Dependency Dashboard
- Not showing Exception stack trace in "Exception" field of the log HOT 13
- Add destructurer for Refit ApiException HOT 4
- Filtering out any property from a direct property of ExceptionDetails HOT 3
- Create Custom Destructurers for More Exceptions HOT 7
- mapper [NpgsqlValue] cannot be changed from type [date] to [ObjectMapper] HOT 3
- EF6 - protection against logging entire db. HOT 1
- Entity Framework Logging Behaviour HOT 2
- Exceptions with large properties HOT 3
- Same Key Added Exception in ExceptionPropertiesBag HOT 5
- [TaskCanceledExceptionDestructurer] Destructured object type inconsistent HOT 1
- Maximum destructuring depth reached. HOT 3
- Demystified exception stack trace support HOT 1
- Serilog.Exceptions.EntityFrameworkCore docs warning unclear HOT 1
- Request that Serilog.Exceptions.EntityFrameworkCore description also includes Serilog appsetting.json example HOT 1
- FOSSA Compliance tool license missing for v4.1.0 HOT 1
- Exceptions not getting logged in Azure App Insights due its size
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from serilog.exceptions.