diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6339ce7e..3a51725e 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,15 +1,39 @@ -## [0.4.0] / 18 July 2022 -- [Add `Microsoft.Extensions.Logging.ILoggerFactory` logging support](https://github.com/akkadotnet/Akka.Hosting/pull/72) +## [0.4.1] / 21 July 2022 +- [Fix `Microsoft.Extensions.Logging.ILoggerFactory` logging support](https://github.com/akkadotnet/Akka.Hosting/pull/81) +- [Add `InMemory` snapshot store and journal persistence support](https://github.com/akkadotnet/Akka.Hosting/pull/84) -You can now use `ILoggerFactory` from Microsoft.Extensions.Logging as one of the sinks for Akka.NET logger. This logger will use the `ILoggerFactory` service set up inside the dependency injection `ServiceProvider` as its sink. +Due to a bad API design, we're rolling back the `Microsoft.Extensions.Logging.ILoggerFactory` logger support introduced in version 0.4.0, the 0.4.0 NuGet version is now considered as deprecated in support of the new API design introduced in version 0.4.1. + +__Logger Configuration Support__ + +You can now use the new `AkkaConfigurationBuilder` extension method called `ConfigureLoggers(Action)` to configure how Akka.NET logger behave. Example: -``` -builder.Services.AddAkka("MyActorSystem", (configurationBuilder, serviceProvider) => +```csharp +builder.Services.AddAkka("MyActorSystem", configurationBuilder => { configurationBuilder - .AddHocon("akka.loglevel = DEBUG") - .WithLoggerFactory() + .ConfigureLoggers(setup => + { + // Example: This sets the minimum log level + setup.LogLevel = LogLevel.DebugLevel; + + // Example: Clear all loggers + setup.ClearLoggers(); + + // Example: Add the default logger + // NOTE: You can also use setup.AddLogger(); + setup.AddDefaultLogger(); + + // Example: Add the ILoggerFactory logger + // NOTE: + // - You can also use setup.AddLogger(); + // - To use a specific ILoggerFactory instance, you can use setup.AddLoggerFactory(myILoggerFactory); + setup.AddLoggerFactory(); + + // Example: Adding a serilog logger + setup.AddLogger(); + }) .WithActors((system, registry) => { var echo = system.ActorOf(act => @@ -25,11 +49,23 @@ builder.Services.AddAkka("MyActorSystem", (configurationBuilder, serviceProvider }); ``` -There are two `Akka.Hosting` extension methods provided: -- `.WithLoggerFactory()`: Replaces all Akka.NET loggers with the new `ILoggerFactory` logger. -- `.AddLoggerFactory()`: Inserts the new `ILoggerFactory` logger into the Akka.NET logger list. +A complete code sample can be viewed [here](https://github.com/akkadotnet/Akka.Hosting/tree/dev/src/Examples/Akka.Hosting.LoggingDemo). + +Exposed properties are: +- `LogLevel`: Configure the Akka.NET minimum log level filter, defaults to `InfoLevel` +- `LogConfigOnStart`: When set to true, Akka.NET will log the complete HOCON settings it is using at start up, this can then be used for debugging purposes. -__Log Event Filtering__ +Currently supported logger methods: +- `ClearLoggers()`: Clear all registered logger types. +- `AddLogger()`: Add a logger type by providing its class type. +- `AddDefaultLogger()`: Add the default Akka.NET console logger. +- `AddLoggerFactory()`: Add the new `ILoggerFactory` logger. + +__Microsoft.Extensions.Logging.ILoggerFactory Logging Support__ + +You can now use `ILoggerFactory` from Microsoft.Extensions.Logging as one of the sinks for Akka.NET logger. This logger will use the `ILoggerFactory` service set up inside the dependency injection `ServiceProvider` as its sink. + +__Microsoft.Extensions.Logging Log Event Filtering__ There will be two log event filters acting on the final log input, the Akka.NET `akka.loglevel` setting and the `Microsoft.Extensions.Logging` settings, make sure that both are set correctly or some log messages will be missing. @@ -47,3 +83,9 @@ To set up the `Microsoft.Extensions.Logging` log filtering, you will need to edi } } ``` + +__InMemory Snapshot Store And Journal Support__ + +You can now use these `AkkaConfigurationBuilder` extension methods to enable `InMemory` persistence back end: +- `WithInMemoryJournal()`: Sets the `InMemory` journal as the default journal persistence plugin +- `WithInMemorySnapshotStore()`: Sets the `InMemory` snapshot store as the default snapshot-store persistence plugin. \ No newline at end of file