BugsRadar

BugsRadar for .NET

Updated 1 October 2026 · BugsRadar team

NuGet packages for ASP.NET Core, worker services, desktop and console apps: BugsRadar with an ILogger provider and direct calls, and a package of its own for Serilog, NLog and log4net.

You need a BugsRadar project with a channel and the project's API key first: see Get started.

The API key is secret: use it only in code that runs on your servers. Never put it in a desktop or mobile app you ship to customers or users - WPF, WinForms, MAUI, Blazor WebAssembly - or in a public repository: anyone can take the key out of them. Where the key may go

Install

Terminal
dotnet add package BugsRadar

Using Serilog, NLog or log4net? Install the package for it instead - it brings BugsRadar with it, so the ILogger provider and direct calls are there too:

LoggerPackage
Serilogdotnet add package BugsRadar.Serilog
NLogdotnet add package BugsRadar.NLog
log4netdotnet add package BugsRadar.Log4Net

The packages target .NET Standard 2.0. The dependencies of BugsRadar are floors, not the latest versions: Microsoft.Extensions.Http 8.0, Microsoft.Extensions.Logging.Abstractions 8.0 and Newtonsoft.Json 13.0.4. If your application already uses newer versions, they stay as they are. Serilog 4.4.0, NLog 6.2.1 and log4net 3.4.0 come only with their own packages.

Register the client

In an application with dependency injection - ASP.NET Core, a worker service - register BugsRadar once:

Program.cs
using BugsRadar.Extensions.DependencyInjection;

builder.Services.AddBugsRadar(configuration =>
{
    configuration.ApiKey = "<your project API key>";
    configuration.Environment = builder.Environment.EnvironmentName; // optional
});

Treat the key like any other secret and keep it out of source control, for example in configuration: configuration.ApiKey = builder.Configuration["BugsRadar:ApiKey"];. The key is required: an empty one throws ArgumentException when the client is created.

Loggers

Each logger has a page of its own, with the package to install and the configuration:

Direct calls

Inject IBugsRadar and report exceptions or your own events:

OrderService.cs
using BugsRadar;

public class OrderService
{
    private readonly IBugsRadar _bugsRadar;

    public OrderService(IBugsRadar bugsRadar)
    {
        _bugsRadar = bugsRadar;
    }

    public void CreateOrder(int orderId)
    {
        try
        {
            // ...
        }
        catch (Exception error)
        {
            _bugsRadar.SendException(error, "OrderService : CreateOrder", module: "Orders");

            // or the full model
            _bugsRadar.Send(new BugsRadarEvent
            {
                Exception = error,
                MessageTemplate = "Order {OrderId} failed",
                Message = $"Order {orderId} failed",
                Properties = { ["OrderId"] = orderId.ToString() },
                Module = "Orders"
            });
        }
    }
}

Send and SendException queue the event and return at once, so reporting an error never adds network time to your own code. The only method that waits for the network is FlushAsync, for a process that is about to exit. Nothing throws: delivery problems are written to ILogger under the category BugsRadar.Client.

BugsRadar groups repeats of an error by a fingerprint it computes from the exception type and the top frames of the stack, or from the message template. To group by your own key, set Fingerprint on the event.

Console apps and scripts

Program.cs
using BugsRadar;

using var bugsRadar = new BugsRadarClient(new BugsRadarConfiguration { ApiKey = "<your project API key>" });

bugsRadar.SendException(error);

await bugsRadar.FlushAsync(); // before exit; Dispose also drains the queue

A script that isn't .NET - Bash, PowerShell, a CI step, a SQL Server Agent job - sends an alert with one HTTP request: see Send alerts from any script.

How events travel

Configuration

PropertyDefaultMeaning
ApiKey-Project API key from app.bugsradar.com. Required.
EnvironmentnullDefault environment name for events (Production, Staging).
Hostmachine nameDefault host for events.
AppVersionentry assembly versionDefault application version. Not used for grouping.
MinimumLevelErrorMinimum level for the ILogger provider.
RepeatInterval5 sRepeats within this interval travel as one request.
QueueCapacity1000Queued events beyond this are dropped with a warning.
ShutdownTimeout10 sHow long Dispose waits for the queue to drain.
RequestTimeout15 sOne request to the server.
ApiUrlapi.bugsradar.comChange it only for a self-hosted BugsRadar.

Upgrading

3.0.0.3 moves the Serilog sink to its own package, and BugsRadar no longer depends on Serilog. If you use WriteTo.BugsRadar, add BugsRadar.Serilog: the method and the namespace BugsRadar.Extensions.Serilog are the same, so the code does not change.

API v2 is shut down: versions of the package below 3.0.0.1 no longer deliver error reports and are not supported. Update to 3.0.0.2 or later. The package major version matches the API version it talks to: 3.x uses API v3.

The package no longer depends on ASP.NET Core. If your application calls AddNewtonsoftJson and relied on BugsRadar 1.x to bring it in, reference Microsoft.AspNetCore.Mvc.NewtonsoftJson directly.

3.0.0.2 removes SendAsync and SendExceptionAsync. They completed only once the event had been delivered, so awaiting one inside a catch put a network round trip into the path of your own request. Send and SendException give you the same duplicate filtering, repeat aggregation and retries without the wait; call FlushAsync before a short-lived process exits.

Something doesn't arrive? Problems on the way from your application to BugsRadar are logged under the BugsRadar.Client category - include those lines when you write to support@bistriy.com.

Next: ILogger provider →