-
Notifications
You must be signed in to change notification settings - Fork 97
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
Application Insight Exception metadata type with EvenSource input #92
Comments
Good question. I think you have a few options. One is to use EventSource.Write method https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource.write(v=vs.110).aspx This should work well if you are using .NET Core, although I will be honest--I haven't tested it. Unfortunately with full framework there is a bug in the framework that prevents EventFlow from reading the event level correctly, so it is not a recommended way if you are using full (desktop) framework. Second option is to use a different logging library (e.g. Microsoft.Extensions.Logging, Serilog) that allows you to pass arbitrary objects into EventFlow. Yet another option is to use custom EventFlow input. That should be not nearly as troublesome as a custom output for AI. I think you could even integrate it with your EventSource e.g. by making the EventSource implement IObservable and using [NonEvent] methods to raise events that carry exception objects. This way you will have just one logging API, your EventSource, for the application to use. Hope this is helpful Update December 2018: when suggesting the first option ( |
Thanks for the input and solid suggestions. I am using framework 4.6.1 within ServiceFabric hence the first option won't work. I will go with the third option in my next iteration of the project in a couple of weeks time. |
Hi, @karolz-ms
Am I looking at the wrong method? Thank you |
@erickbp you are correct and I was wrong. It is not possible to use The other two options are valid. |
@karolz-ms thanks for clarifying, I followed your option number 2 (Serilog), thanks for suggesting it. |
@erickbp cool. Just wanted to mention that EventFlow acquired a DiagnosticSource input recently, so that could be a good alternative if you want to keep non-framework dependencies to absolute minimum. That said, Serilog is great and has been supported by EventFlow almost since the beginning, so it is a fine choice too. |
@karolz-ms good to know. Thank you |
I'm using EventSource as the input and AI as an output. Looking at the documentation
here, in the section that relates to applying metadata to AI exception type,
However, EventSource does not allow you to supply a System.Exception type, nor even an object as a message argument.
Any ideas on how to get this to work with EventSource? Is this even supported for this output type? I've looked at the tests related to outputs and there isn't anything there for AI exception logging. I'm hopping that I won't have to go down the route of writing a custom output to achieve this.
{ "type": "metadata", "include": "ProviderName == PersonalLoanWebService-ApplicationEvents && EventName == ApplicationError", "metadata": "exception", "exceptionProperty": "exception" }
The text was updated successfully, but these errors were encountered: