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
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:
| Logger | Package |
|---|---|
| Serilog | dotnet add package BugsRadar.Serilog |
| NLog | dotnet add package BugsRadar.NLog |
| log4net | dotnet 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:
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:
- ILogger provider - everything you log at
Errorand above throughMicrosoft.Extensions.Logging, with templates, properties, scopes and categories. - Serilog sink -
BugsRadar.Serilog, with or without dependency injection. - NLog target -
BugsRadar.NLog, in NLog.config or in code. - log4net appender -
BugsRadar.Log4Net, in log4net.config.
Direct calls
Inject IBugsRadar and report exceptions or your own events:
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
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
- Events go to an in-process queue and are sent in the background; your code never waits for the network.
- Repeats of the same error within
RepeatInterval(5 seconds) are folded into one request with a count. A crash loop costs one request every few seconds, not thousands per second. - The same exception instance seen twice by one client - logged and reported by hand, or by
ILoggerand Serilog - is sent once. - On
429the client waits as long as the server asks; on5xxand network failures it retries three times. - When the application stops,
Disposedrains the queue forShutdownTimeout(10 seconds).
Configuration
| Property | Default | Meaning |
|---|---|---|
ApiKey | - | Project API key from app.bugsradar.com. Required. |
Environment | null | Default environment name for events (Production, Staging). |
Host | machine name | Default host for events. |
AppVersion | entry assembly version | Default application version. Not used for grouping. |
MinimumLevel | Error | Minimum level for the ILogger provider. |
RepeatInterval | 5 s | Repeats within this interval travel as one request. |
QueueCapacity | 1000 | Queued events beyond this are dropped with a warning. |
ShutdownTimeout | 10 s | How long Dispose waits for the queue to drain. |
RequestTimeout | 15 s | One request to the server. |
ApiUrl | api.bugsradar.com | Change 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.