MindscapeHQ / serilog-sinks-raygun

A Serilog sink that writes events to Raygun
Apache License 2.0
11 stars 20 forks source link

Sink not writing to Raygun #62

Closed jaymarvels closed 1 year ago

jaymarvels commented 1 year ago

.NET6 ASP Core proj here

Implemented as per readme in my appsettings:

image

I purposely throw an exception

image

I check Raygun and nothing has been logged/comes through.

QuantumNightmare commented 1 year ago

Apologies that it isn't clear - the Raygun Serilog Sink won't automatically listen to unhandled exception like other Raygun providers. It instead responds to the Log.Error and Log.Fatal calls.

Log.Fatal sends exceptions to Raygun synchronously and is needed when an exception is going to cause the process to crash. Log.Error sends exceptions to Raygun asynchronously so that it doesn't interrupt the process.

Within the global unhandled exception handler of your .NET6 ASP Core project, you'll want to make a Log.Error call. Best do this from all catch blocks throughout your project too.

Let us know if you have further questions.

jaymarvels commented 1 year ago

@QuantumNightmare Ahh thanks for clarifying! Thought I was missing something!

Do you know which other providers automatically listen for unhandled exceptions?

QuantumNightmare commented 1 year ago

We have quite a few different providers across several languages/frameworks. I've mostly worked in the .NET space.

The .NET Framework ones for web applications usually have an http module that you add to the configuration which will cause them to hook into various exception handlers. The .NET Core provider can attach via the middleware. Some other .NET Raygun providers have a method like "AttachCrashReporting" that will hook into the global exception handler if they are statically available. Most native mobile providers should be able to do this as well.

Not sure if that covers what you're after, so let me know if anything needs clarifying.

QuantumNightmare commented 1 year ago

Will close this issue now. Do reply or start a new issue if you have further questions.