Serilog Setup With Raygun
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.
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:
- Raygun uses exception message as the error title. If you log any messages without an exception. The messages will be grouped under
Unknown error
. - The
restrictedToMinimumLevel
argument defaults to Error. You may set upMinimumLevel
toDebug
. But it still only logs errors and fatals. You’d better not to change the valules, because Raygun only likes exceptions.