-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update RELEASE_NOTES.md for v0.4.2 release (#93)
- Loading branch information
Showing
2 changed files
with
17 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,27 @@ | ||
## [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) | ||
## [0.4.2] / 11 August 2022 | ||
- [Update Akka.NET from 1.4.39 to 1.4.40](https://github.com/akkadotnet/akka.net/releases/tag/1.4.40) | ||
- [Add `WithExtensions()` method](https://github.com/akkadotnet/Akka.Hosting/pull/92) | ||
- [Add `AddStartup` method](https://github.com/akkadotnet/Akka.Hosting/pull/90) | ||
|
||
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. | ||
__WithExtensions()__ | ||
|
||
__Logger Configuration Support__ | ||
|
||
You can now use the new `AkkaConfigurationBuilder` extension method called `ConfigureLoggers(Action<LoggerConfigBuilder>)` to configure how Akka.NET logger behave. | ||
`AkkaConfigurationBuilder.WithExtensions()` is used to configure the `akka.extensions` HOCON settings. It is used to set an Akka.NET extension provider to start-up automatically during `ActorSystem` start-up. | ||
|
||
Example: | ||
```csharp | ||
builder.Services.AddAkka("MyActorSystem", configurationBuilder => | ||
{ | ||
configurationBuilder | ||
.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<DefaultLogger>(); | ||
setup.AddDefaultLogger(); | ||
|
||
// Example: Add the ILoggerFactory logger | ||
// NOTE: | ||
// - You can also use setup.AddLogger<LoggerFactoryLogger>(); | ||
// - To use a specific ILoggerFactory instance, you can use setup.AddLoggerFactory(myILoggerFactory); | ||
setup.AddLoggerFactory(); | ||
|
||
// Example: Adding a serilog logger | ||
setup.AddLogger<SerilogLogger>(); | ||
}) | ||
.WithActors((system, registry) => | ||
{ | ||
var echo = system.ActorOf(act => | ||
{ | ||
act.ReceiveAny((o, context) => | ||
{ | ||
Logging.GetLogger(context.System, "echo").Info($"Actor received {o}"); | ||
context.Sender.Tell($"{context.Self} rcv {o}"); | ||
}); | ||
}, "echo"); | ||
registry.TryRegister<Echo>(echo); // register for DI | ||
}); | ||
}); | ||
// Starts distributed pub-sub, cluster metrics, and cluster bootstrap extensions at start-up | ||
builder.WithExtensions( | ||
typeof(DistributedPubSubExtensionProvider), | ||
typeof(ClusterMetricsExtensionProvider), | ||
typeof(ClusterBootstrapProvider)); | ||
``` | ||
|
||
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. | ||
|
||
Currently supported logger methods: | ||
- `ClearLoggers()`: Clear all registered logger types. | ||
- `AddLogger<TLogger>()`: 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. | ||
__AddStartup()__ | ||
|
||
__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. | ||
|
||
To set up the `Microsoft.Extensions.Logging` log filtering, you will need to edit the `appsettings.json` file. Note that we also set the `Akka` namespace to be filtered at debug level in the example below. | ||
|
||
```json | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft": "Warning", | ||
"Microsoft.Hosting.Lifetime": "Information", | ||
"Akka": "Debug" | ||
} | ||
} | ||
} | ||
``` | ||
`AddStartup()` method adds `StartupTask` delegate to the configuration builder. | ||
|
||
__InMemory Snapshot Store And Journal Support__ | ||
This feature is useful when a user need to run a specific initialization code if anf only if the `ActorSystem` and all of the actors have been started. Although it is semantically the same as `AddActors` and `WithActors`, it disambiguate the use-case with a guarantee that it will only be executed after everything is ready. | ||
|
||
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. | ||
For example, this feature is useful for: | ||
- kicking off actor initializations by using Tell()s once all of the actor infrastructure are in place, or | ||
- pre-populating certain persistence or database data after everything is set up and running, useful for unit testing or adding fake data for local development. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters