MindscapeHQ / serilog-sinks-raygun

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

Error not being sent to Raygun #63

Closed ngocphamm closed 1 year ago

ngocphamm commented 1 year ago

Hi,

I'm trying to use this package to send errors/messages to Raygun but I can't figure out why it's not doing so.

This is what I have in a simple unit test method using MSTest.

[TestMethod]
public void Test()
{
    using (var logger = new LoggerConfiguration()
        .MinimumLevel.Debug()
        .WriteTo.File(@"d:\path\to\file.log", rollingInterval: RollingInterval.Day)
        .WriteTo.Raygun("api-key-here")
        .CreateLogger())
    {
        logger.Error(new Exception("test log with Serilog & Raygun"), "Test");
    }
}

It logged to the file properly, but I don't see anything in Raygun.

This is a .NET Framework 4.7.2 project.

I saw this issue https://github.com/MindscapeHQ/serilog-sinks-raygun/issues/62#issuecomment-1687078899, and already tried logger.Fatal() call hoping it's sync/async issue but that didn't help either.

ngocphamm commented 1 year ago

It's working now for some reason... Not sure if I didn't properly call logger.Fatal() before or what, but just now I come back to this, changed to logger.Fatal() and it worked. Changing back to logger.Error() requires some .Sleep() time to work, but that is kinda expected.

QuantumNightmare commented 1 year ago

hi ngocphamm,

Glad to hear logger.Fatal() did indeed work in this case!