NLog.Targets.KafkaAppender 2.0.0

.NET Core 2.1 .NET Standard 2.0 .NET Framework 4.5
NuGet\Install-Package NLog.Targets.KafkaAppender -Version 2.0.0
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.
dotnet add package NLog.Targets.KafkaAppender --version 2.0.0
<PackageReference Include="NLog.Targets.KafkaAppender" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NLog.Targets.KafkaAppender --version 2.0.0
#r "nuget: NLog.Targets.KafkaAppender, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NLog.Targets.KafkaAppender as a Cake Addin
#addin nuget:?package=NLog.Targets.KafkaAppender&version=2.0.0

// Install NLog.Targets.KafkaAppender as a Cake Tool
#tool nuget:?package=NLog.Targets.KafkaAppender&version=2.0.0


nlog appender for kafka which provides the custom topics pattern and partitions

Supported frameworks

.NET Framework 4.5, 4.6 & 4.7
ASP.NET 4.5+ (NLog.Web package)
ASP.NET Core (NLog.Web.AspNetCore package)
.NET Core (NLog.Extensions.Logging package)
.NET Standard 2.x+ - NLog 4.5

Getting Started

Step 1: Install NLog.Targets.KafkaAppender package from

Install via Package-Manager   Install-Package NLog.Targets.KafkaAppender
Install via .NET CLI          dotnet add package NLog.Targets.KafkaAppender

Step 2: Configure nlog sections

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns=""
    <add assembly="NLog.Targets.KafkaAppender"/>
    <target xsi:type="KafkaAppender"

    <logger name="*" minlevel="Info" writeTo="kafka" />
Param Name Variable Type Requirement Description Default
name :string yes* Target's name
topic :layout yes* Topic pattern can be layout ${logger}
layout :layout no Layout used to format log messages. ${longdate}|${level:uppercase=true}|${logger}|${message}
brokers :string yes* Kafka brokers with comma-separated
async :boolean no Async or sync mode false

Check documentation about all Layout Renderers


using System;

namespace NLog.Targets.KafkaAppender.Test
    class Program
        static void Main(string[] args)
            var logger = NLog.LogManager.GetCurrentClassLogger();
            logger.Error("hello world");
            //topic layout:     ${callsite:className=true:fileName=false:includeSourcePath=false:methodName=true}
            //message layout:   ${longdate}|${level:uppercase=true}|${logger}|${message}
            //topic output:     NLog.Targets.KafkaAppender.Test.Program.Main
            //message output:   2018-12-05 18:27:46.7382|ERROR|NLog.Targets.KafkaAppender.Test.Program|hello world 

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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
2.0.0 1,313 5/16/2022
1.0.8 14,169 9/21/2020
1.0.7 1,229 7/21/2020
1.0.6 5,865 12/6/2019
1.0.5 16,146 8/2/2019
1.0.4 572 5/1/2019
1.0.3 1,615 12/7/2018
1.0.2 488 12/5/2018
1.0.1 472 12/5/2018