Skip to content

Resolve akka.loggers names before starting any logger - #8778

Merged
Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/validate-loggers-before-start
Oct 6, 2026
Merged

Aaronontheweb merged 3 commits into
akkadotnet:devfrom
Aaronontheweb:fix/validate-loggers-before-start

Conversation

@Aaronontheweb

@Aaronontheweb Aaronontheweb commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Addresses the logger-startup case in #8772.

LoggingBus.StartDefaultLoggers started the LoggerSetup loggers and then resolved akka.loggers one entry at a time. A name that could not be resolved threw ConfigurationException after earlier loggers had already been started, so their actors were constructed in the background after ActorSystem.Create had thrown. Every akka.loggers name is now resolved before the first logger starts. Exception types, messages and start order are unchanged.

The two new specs also point akka.loggers-dispatcher at a dispatcher that does not exist, which makes starting any logger throw synchronously. The exception that comes out shows which happened first. Against the old code both specs fail with "Dispatcher [no-such-loggers-dispatcher] not configured"; with this change they get the unresolvable-name error.

This does not change the general behavior described in #8772 for other startup failures.

A name that could not be resolved made ActorSystem.Create throw after earlier loggers had already been started, so their actors were constructed in the background of a system that never came up. All names are now resolved first. Also report a failed shutdown of a half-started system instead of dropping the Terminate task.
It cannot fault with default settings, so there is nothing worth reporting.
Point akka.loggers-dispatcher at a missing dispatcher so starting any logger throws synchronously. The exception that comes out shows whether names were resolved before the first logger start.

@Aaronontheweb Aaronontheweb left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

await AkkaFeaturesSpec.WithDynamicTypeLoading(false, () =>
{
Action create = () => ActorSystem.Create("UnresolvableLoggerSetupOff", setup);
var thrown = create.Should().Throw<ConfigurationException>().WithMessage("*not built in*");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb
Aaronontheweb merged commit 7880926 into akkadotnet:dev Oct 6, 2026
16 checks passed
@Aaronontheweb Aaronontheweb added this to the 1.6.0 milestone Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant