Akka.Logger.Serilog
1.5.25
Prefix Reserved
dotnet add package Akka.Logger.Serilog --version 1.5.25
NuGet\Install-Package Akka.Logger.Serilog -Version 1.5.25
<PackageReference Include="Akka.Logger.Serilog" Version="1.5.25" />
paket add Akka.Logger.Serilog --version 1.5.25
#r "nuget: Akka.Logger.Serilog, 1.5.25"
// Install Akka.Logger.Serilog as a Cake Addin #addin nuget:?package=Akka.Logger.Serilog&version=1.5.25 // Install Akka.Logger.Serilog as a Cake Tool #tool nuget:?package=Akka.Logger.Serilog&version=1.5.25
Akka.Logger.Serilog
This is the Serilog integration plugin for Akka.NET. Please check out our documentation on how to get the most out of this plugin.
Targets Serilog 2.12.0.
Semantic Logging Syntax
If you intend on using any of the Serilog semantic logging formats in your logging strings, you need to use the SerilogLoggingAdapter inside your instrumented code or there could be elsewhere inside parts of your ActorSystem
:
var log = Context.GetLogger<SerilogLoggingAdapter>(); // correct
log.Info("My boss makes me use {semantic} logging", "semantic"); // serilog semantic logging format
or
var log = MyActorSystem.GetLogger<SerilogLoggingAdapter>(myContextObject); // correct
log.Info("My boss makes me use {semantic} logging", "semantic"); // serilog semantic logging format
or
var log = MyActorSystem.GetLogger<SerilogLoggingAdapter>(contextName, contextType); // correct
log.Info("My boss makes me use {semantic} logging", "semantic"); // serilog semantic logging format
This will allow all logging events to be consumed anywhere inside the ActorSystem
, including places like the Akka.NET TestKit, without throwing FormatException
s when they encounter semantic logging syntax outside of the SerilogLogger
.
Adding Property Enricher To Your Logs
Default Properties
You can add property enrichers to the logging adapter that will be added to all logging calls to that logging adapter.
var log = Context.GetLogger<SerilogLoggingAdapter>()
.ForContext("Address", "No. 4 Privet Drive")
.ForContext("Town", "Little Whinging")
.ForContext("County", "Surrey")
.ForContext("Country", "England");
log.Info("My boss makes me use {Semantic} logging", "semantic");
All logging done using the log
ILoggingAdapter
instance will append "Address", "Town", "County", and "Country" properties into the Serilog log.
One-off Properties
You can add one-off property to a single log message by appending PropertyEnricher
instances at the end of your logging calls.
var log = Context.GetLogger<SerilogLoggingAdapter>();
log.Info(
"My boss makes me use {Semantic} logging", "semantic",
new PropertyEnricher("County", "Surrey"),
new PropertyEnricher("Country", "England"));
This log entry will have "County" and "Country" properties added to it.
Automatically Convert ILoggingAdapter
into SerilogLoggingAdapter
As of Akka.Logger.Serilog v1.5.25, you can now do the following:
var log = Context.GetLogger()
.ForContext("Address", "No. 4 Privet Drive")
.ForContext("Town", "Little Whinging")
.ForContext("County", "Surrey")
.ForContext("Country", "England");
log.Info("My boss makes me use {Semantic} logging", "semantic");
And it will work without having to explicitly call Context.GetLogger<SerilogLoggingAdapter>()
first.
Building this solution
To run the build script associated with this solution, execute the following:
Windows
c:\> build.cmd all
Linux / OS X
c:\> build.sh all
If you need any information on the supported commands, please execute the build.[cmd|sh] help
command.
This build script is powered by FAKE; please see their API documentation should you need to make any changes to the build.fsx
file.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Akka.Logger.Serilog:
Package | Downloads |
---|---|
SharpPulsar
SharpPulsar is Apache Pulsar Client built using Akka.net |
|
SnD.Sdk
SDK for Sneaks&Data OSS Projects |
|
EventSaucing
An event source stack based on NEventStore and Akka |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.5.25 | 43,986 | 6/17/2024 |
1.5.12.1 | 239,182 | 9/14/2023 |
1.5.12 | 10,920 | 8/31/2023 |
1.5.7 | 161,549 | 5/19/2023 |
1.5.0.1 | 59,858 | 3/15/2023 |
1.5.0 | 30,355 | 3/2/2023 |
1.5.0-beta5 | 275 | 3/1/2023 |
1.4.42 | 216,836 | 9/23/2022 |
1.4.26 | 413,157 | 10/7/2021 |
1.4.25 | 16,392 | 9/9/2021 |
1.4.17 | 159,294 | 3/17/2021 |
1.4.11 | 242,457 | 11/7/2020 |
1.4.10 | 11,378 | 10/28/2020 |
1.4.8 | 100,188 | 7/1/2020 |
1.4.3 | 58,614 | 3/27/2020 |
1.4.1 | 5,415 | 3/11/2020 |
1.4.1-rc3 | 416 | 3/10/2020 |
1.4.1-RC1 | 512 | 3/2/2020 |
1.3.11 | 44,276 | 2/5/2020 |
1.3.10 | 88,969 | 10/5/2019 |
1.3.9 | 292,500 | 8/23/2018 |
1.3.6 | 92,664 | 4/30/2018 |
1.3.3 | 44,429 | 2/1/2018 |
1.3.0 | 28,673 | 8/15/2017 |
1.2.0 | 14,696 | 5/2/2017 |
1.1.3 | 5,637 | 2/15/2017 |
1.1.2 | 10,295 | 10/11/2016 |
1.1.1 | 5,547 | 7/16/2016 |
1.0.8 | 10,768 | 4/28/2016 |
1.0.7 | 1,737 | 4/7/2016 |
1.0.6 | 4,368 | 1/18/2016 |
1.0.5 | 2,327 | 12/3/2015 |
1.0.4 | 3,104 | 8/8/2015 |
1.0.3 | 1,760 | 6/12/2015 |
1.0.2 | 1,375 | 6/3/2015 |
1.0.1 | 1,796 | 4/28/2015 |
1.0.0 | 1,398 | 4/9/2015 |
1.0.0-dev1504032244 | 1,079 | 4/3/2015 |
0.8.0 | 1,605 | 2/12/2015 |
0.7.1 | 1,597 | 12/13/2014 |
0.7.0 | 3,232 | 10/20/2014 |
[Update Akka.Hosting to 1.5.25](https://github.com/akkadotnet/akka.net/releases/tag/1.5.25)
[implicitly convert regular `BusLogger` to `SerilogLoggingAdapter` when `ForContext` is called](https://github.com/akkadotnet/Akka.Logger.Serilog/pull/285)
As of Akka.Logger.Serilog v1.5.25, you can now do the following:
```csharp
var log = Context.GetLogger()
.ForContext("Address", "No. 4 Privet Drive")
.ForContext("Town", "Little Whinging")
.ForContext("County", "Surrey")
.ForContext("Country", "England");
log.Info("My boss makes me use {Semantic} logging", "semantic");
```
And it will work without having to explicitly call `Context.GetLogger<SerilogLoggingAdapter>()` first.