BugsRadar.NLog 3.0.0.6

dotnet add package BugsRadar.NLog --version 3.0.0.6
                    
NuGet\Install-Package BugsRadar.NLog -Version 3.0.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BugsRadar.NLog" Version="3.0.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BugsRadar.NLog" Version="3.0.0.6" />
                    
Directory.Packages.props
<PackageReference Include="BugsRadar.NLog" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BugsRadar.NLog --version 3.0.0.6
                    
#r "nuget: BugsRadar.NLog, 3.0.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BugsRadar.NLog@3.0.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BugsRadar.NLog&version=3.0.0.6
                    
Install as a Cake Addin
#tool nuget:?package=BugsRadar.NLog&version=3.0.0.6
                    
Install as a Cake Tool

BugsRadar.NLog

NLog target for BugsRadar - https://bugsradar.com/

Errors your application writes to NLog arrive in Telegram, Discord or Pushover, with the message template, properties and the logger name. The package brings the BugsRadar package with it, so direct calls and the ILogger provider are there too.

Full documentation: https://bugsradar.com/docs/dotnet/nlog/

Install

dotnet add package BugsRadar.NLog

NLog.config

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <extensions>
    <add assembly="BugsRadar.NLog" />
  </extensions>
  <targets>
    <target xsi:type="BugsRadar" name="bugsradar"
            apiKey="${environment:BUGSRADAR_KEY}" environment="Production" />
  </targets>
  <rules>
    <logger name="*" minlevel="Error" writeTo="bugsradar" />
  </rules>
</nlog>

apiKey and environment are NLog layouts: ${environment:...} reads an environment variable, ${configsetting:...} reads appsettings.json through NLog.Extensions.Logging.

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) or in a public repository: anyone can take the key out of them.

In code

using BugsRadar.Extensions.NLog;
using NLog;

LogManager.Setup()
    .SetupExtensions(s => s.RegisterTarget<BugsRadarTarget>("BugsRadar"))
    .LoadConfiguration(c => c.ForLogger().FilterMinLevel(LogLevel.Error)
        .WriteTo(new BugsRadarTarget { ApiKey = "<your project API key>" }));

ASP.NET Core and dependency injection

When NLog is the host's logger through NLog.Extensions.Logging or NLog.Web.AspNetCore and the client is registered with services.AddBugsRadar(...), leave apiKey out: the target takes that client from DI, and an error that both ILogger and NLog see is sent once.

What arrives

  • Levels: Error and above. The rules decide what reaches the target; minimumLevel="Warn" on the target lowers its own floor.
  • logger.Error(ex, "Order {OrderId} failed", 42) arrives with the template Order {OrderId} failed and the property OrderId = 42, so failures of different orders are one error with a count. A text without parameters is grouped with numbers, ids and quoted values masked.
  • LogManager.Shutdown() drains the queue for up to 10 seconds; LogManager.Flush() waits for what is queued.
  • Delivery problems of the target's own client go to NLog's internal log: internalLogLevel="Warn" internalLogToConsoleError="true".

Dependencies

NLog 6.2.1 and the BugsRadar package of the same version.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.0.6 134 10/1/2026

3.0.0.6: with NLog 6, logger.Error("Order {OrderId} failed", 42) lost its message template and logger.Error("Order {OrderId} failed: {Error}", 42, exception) lost the exception: NLog 6 passes the arguments of these overloads as message template parameters, which the target reads now. An exception passed as a parameter is no longer repeated as a property. New attribute apiUrl, for a self-hosted BugsRadar only. The target keeps out only the package's own logger, BugsRadar.Client; your own BugsRadar.* loggers are reported now. Requires BugsRadar 3.0.0.6, which fixes the ILogger provider and the casing of property names. 3.0.0.5: no code changes; the author of the package is now BistriySpzoo, the same as the owner on nuget.org. 3.0.0.4: no code changes; the README and the package links point to the new documentation pages at bugsradar.com. 3.0.0.3: first version. The BugsRadar target for NLog: NLog.config or code, API key as a layout, or the client from DI with NLog.Extensions.Logging.