ToolNET.NLog.Kafka 5.0.0

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.0
                    
NuGet\Install-Package ToolNET.NLog.Kafka -Version 5.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.
<PackageReference Include="ToolNET.NLog.Kafka" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ToolNET.NLog.Kafka" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ToolNET.NLog.Kafka" />
                    
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 ToolNET.NLog.Kafka --version 5.0.0
                    
#r "nuget: ToolNET.NLog.Kafka, 5.0.0"
                    
#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 ToolNET.NLog.Kafka@5.0.0
                    
#: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=ToolNET.NLog.Kafka&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ToolNET.NLog.Kafka&version=5.0.0
                    
Install as a Cake Tool

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.  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. 
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 463 12/9/2022
5.0.8 606 6/15/2022
5.0.2 622 3/3/2022
5.0.1 583 3/2/2022
5.0.0 580 2/23/2022