Better Stack .NET logging

Start logging in 2 minutes

Collect logs from C# applications.

1. Install

Install Logtail and NLog.Extension.Logging packages:

Dotnet CLI
dotnet add package Logtail
dotnet add package NLog.Extensions.Logging

Using Visual Studio?
Install packages in Tools -> Manage NuGet Packages....

2. Setup

Set up NLog logging with Logtail. Save the following config as nlog.config in your project root:

NLog config
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns=""
        <add assembly="Logtail" />

        <target xsi:type="Logtail" name="logtail" sourceToken="$SOURCE_TOKEN" />

        <logger name="*" minlevel="Trace" writeTo="logtail" />

3. Setup

Add the following configuration to your .csproj file:

Project config
  <None Update="nlog.config" CopyToOutputDirectory="Always" />

Using Visual Studio?
Right-click file nlog.config -> Quick Properties -> Copy to Output Directory.

4. Start logging ๐ŸŽ‰

Use NLog logger as usual:

Send logs to Logtail
var logger = NLog.LogManager.GetCurrentClassLogger();

logger.Error("Something bad happened.");
logger.Info("Log message with structured logging. {object}", new {
  item="Orange Soda",
logger.Info("User has bought {item} for {price}.", "Orange Soda", 100.00);

You should see your logs in Logtail -> Live tail.
Find passed structured data under the field.


.NET version 5 or higher is required.

Need help?

Please let us know at
We're happy to help! ๐Ÿ™