ToolNET.NLog.Kafka 5.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ToolNET.NLog.Kafka --version 5.0.2                
NuGet\Install-Package ToolNET.NLog.Kafka -Version 5.0.2                
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="ToolNET.NLog.Kafka" Version="5.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToolNET.NLog.Kafka --version 5.0.2                
#r "nuget: ToolNET.NLog.Kafka, 5.0.2"                
#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.
// Install ToolNET.NLog.Kafka as a Cake Addin
#addin nuget:?package=ToolNET.NLog.Kafka&version=5.0.2

// Install ToolNET.NLog.Kafka as a Cake Tool
#tool nuget:?package=ToolNET.NLog.Kafka&version=5.0.2                

1.配置文件格式:

<?xml version="1.0" encoding="utf-8" ?>
<nlog autoReload="true" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="false" throwConfigExceptions="false" internalLogLevel="Trace" >
	<targets>
		<target name="queue" xsi:type="kafka" host="127.0.0.1:9092" topic="test" appname="nlogtest" includeMdc="true" >
			<producerSetting key="queue.buffering.max.messages" value="2000000" /> 
			<producerSetting key="message.send.max.retries" value="3" />           
			<producerSetting key="retry.backoff.ms" value="500" />                 
		</target>
	</targets>
	<rules>
		<logger name="*" writeTo="queue" />
		<logger name="kafka" writeTo="queue" />
	</rules>
</nlog>

2.方法调用

工具类名 说明
NLogUtils 日志写入
LoggerExtensions 日志写入扩展函数,扩展原生日志组件

3.原生日志组件替换

 public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                }).UseNLogKafka(); //替换日志组件       
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ToolNET.NLog.Kafka:

Package Downloads
ToolNET.Infrastructure.WebFilters

日志过滤器/全局异常过滤器

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.1.0 343 12/9/2022
5.0.8 466 6/15/2022
5.0.2 488 3/3/2022
5.0.1 445 3/2/2022
5.0.0 440 2/23/2022