![]() |
VOOZH | about |
dotnet add package Serilog.Sinks.Udp --version 10.0.1
NuGet\Install-Package Serilog.Sinks.Udp -Version 10.0.1
<PackageReference Include="Serilog.Sinks.Udp" Version="10.0.1" />
<PackageVersion Include="Serilog.Sinks.Udp" Version="10.0.1" />Directory.Packages.props
<PackageReference Include="Serilog.Sinks.Udp" />Project file
paket add Serilog.Sinks.Udp --version 10.0.1
#r "nuget: Serilog.Sinks.Udp, 10.0.1"
#:package Serilog.Sinks.Udp@10.0.1
#addin nuget:?package=Serilog.Sinks.Udp&version=10.0.1Install as a Cake Addin
#tool nuget:?package=Serilog.Sinks.Udp&version=10.0.1Install as a Cake Tool
π CI/CD
π codecov
π NuGet Version
π SemVer compatible
π NuGet
π Documentation
π Join the chat at https://gitter.im/serilog/serilog
π Help
Package - Serilog.Sinks.Udp | Platforms - .NET Framework 4.6.2, .NET Standard 2.0/2.1
In the following example, the sink will send UDP packages on the network to localhost on port 7071.
Serilog.ILogger log = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.Udp("localhost", 7071, AddressFamily.InterNetwork)
.CreateLogger();
Used in conjunction with Serilog.Settings.Configuration the sink can be configured in appsettings.json.
{
"Serilog": {
"MinimumLevel": "Verbose",
"WriteTo": [
{
"Name": "Udp",
"Args": {
"remoteAddress": "localhost",
"remotePort": 7071,
"family": "InterNetwork"
}
}
]
}
}
Used in conjunction with Serilog.Settings.AppSettings the sink can be configured in XML <appSettings>.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="serilog:minimum-level" value="Verbose" />
<add key="serilog:using:Udp" value="Serilog.Sinks.Udp" />
<add key="serilog:write-to:Udp" />
<add key="serilog:write-to:Udp.remoteAddress" value="localhost" />
<add key="serilog:write-to:Udp.remotePort" value="7071" />
<add key="serilog:write-to:Udp.family" value="InterNetwork" />
</appSettings>
</configuration>
Producing log events is only half the story. Unless you are consuming them in a matter that benefits you in development or production, there is really no need to produce them in the first place.
In development I've been sending UDP packages to the loopback address, and used Log2Console to visualize them. It supports UDP receivers, and allows me to filter and search according to my needs.
Taking it to the next level is when you as a team agree on sending the log events to a multicast address, making them accessible to all team members. This can be beneficial for Quality Assurance who wishes to monitor log events from all instances of your running application.
The event formatter is an output template on steroids. It has the responsibility of turning a single log event into a textual representation. It can serialize the log event into JSON, XML or anything else that matches the expectations of the receiver.
The sink comes pre-loaded with two XML based event formatters. One is matching the log4j schema expected by Log2Console and the other is matching the log4net schema expected by Log4View.
Log4jTextFormatterThe log event is formatted according to the log4j XML schema expected by Log2Console.
<log4j:event logger="Some.Serilog.Context" timestamp="1184286222308" level="ERROR" thread="1">
<log4j:message>Something failed</log4j:message>
<log4j:throwable>An exception describing the failure<log4j:throwable>
</log4j:event>
Log4netTextFormatterThe log event is formatted according to the log4net XML schema expected by Log4View.
<log4net:event logger="Some.Serilog.Context" timestamp="2017-09-01T22:00:00.000+02:00" level="DEBUG" thread="1" username="MACHINE\username" domain="dotnet">
<log4net:locationInfo class="Some.Serilog.Context" method="System.String Get(Int32)"/>
<log4net:properties>
<log4net:data name="log4net:HostName" value="MACHINE"/>
</log4net:properties>
<log4net:message>Something went wrong.</log4net:message>
<log4net:throwable>System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.</log4net:throwable>
</log4net:event>
The following sample applications demonstrate the usage of this sink in various contexts:
If you want to include the UDP sink in your project, you can install it directly from NuGet.
To install the sink, run the following command in the Package Manager Console:
PM> Install-Package Serilog.Sinks.Udp
If this project has helped you to stay productive and save money, you can buy me a cup of coffee π
Thank you JetBrains for your important initiative to support the open source community with free licenses to your products.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 is compatible. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on Serilog.Sinks.Udp:
| Package | Downloads |
|---|---|
|
MTD.BM.Common
ζ€ζ¨‘εδΈΊMTDη³»η»εΊη‘樑εοΌε ε«ε€δΈͺη»δ»Ά |
|
|
GL
Package Description |
|
|
CnWeb.Top.Logging
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.1 | 58,047 | 1/3/2026 |
| 10.0.0 | 911,722 | 4/3/2024 |
| 10.0.0-beta.1 | 188 | 4/3/2024 |
| 9.0.0 | 302,373 | 10/19/2023 |
| 9.0.0-beta.2 | 3,188 | 6/1/2023 |
| 8.0.1 | 982,123 | 11/20/2022 |
| 8.0.0 | 179,712 | 3/26/2022 |
| 7.1.0 | 504,181 | 10/19/2020 |
| 7.0.1 | 24,388 | 8/14/2020 |
| 7.0.0 | 1,054,864 | 3/9/2020 |
| 6.0.0 | 333,517 | 7/8/2019 |
| 6.0.0-beta4 | 1,243 | 7/7/2019 |
| 6.0.0-beta3 | 1,215 | 6/30/2019 |
| 6.0.0-beta2 | 4,310 | 3/29/2019 |
| 6.0.0-beta1-6.0.0-beta1-00689 | 11,793 | 3/27/2019 |
| 5.0.1 | 134,460 | 1/6/2019 |
| 5.0.0 | 14,929 | 9/13/2018 |
| 4.1.0 | 574,016 | 6/6/2018 |
| 4.1.0-release-4-1-0-beta-1-... | 1,969 | 6/1/2018 |
For release notes, please see the change log on GitHub.