Raygun is a very popular monitoring tool. Serilog.Sinks.Raygun is a Serilog sink that writes events to Raygun. This tutorial will demo how to set it up for an AspNetCore project.

Firstly, follow Serilog Setup for AspNetCore to set up Serilog for the project.

Then, install nuget package Serilog.Sinks.Raygun.

Now you can add the configuration.

{
    "Name": "Raygun",
    "Args": {
        "applicationKey": "RaygunAPIKey",
        "tags": [ "ProjectName" ]
    }
}

Replace RaygunAPIKey and ProjectName with your own value. The sink has a few other arguments. You can refer to its document to configure them.

There are a few points that deserve your attention:

  1. Raygun uses exception message as the error title. If you log any messages without an exception. The messages will be grouped under Unknown error.
  2. The restrictedToMinimumLevel argument defaults to Error. You may set up MinimumLevel to Debug. But it still only logs errors and fatals. You’d better not to change the valules, because Raygun only likes exceptions.