Fix WithDefaultLogMessageFormatter rejecting built-in formatters#711
Merged
Aaronontheweb merged 1 commit intoFeb 10, 2026
Conversation
…adotnet#703) SemanticLogMessageFormatter and DefaultLogMessageFormatter have private constructors (they use singleton Instance properties). The validation in LoggerConfigBuilder.LogMessageFormatter incorrectly rejected them because GetConstructor([]) only finds public constructors. Core Akka.NET's Settings.cs already special-cases these types at runtime. Skip the constructor check for built-in formatter types. Also deprecate WithDefaultLogMessageFormatter<T>() since SemanticLogMessageFormatter is now the default as of Akka.NET 1.5.58.
Aaronontheweb
added a commit
to Aaronontheweb/Akka.Hosting
that referenced
this pull request
Feb 10, 2026
Aaronontheweb
added a commit
that referenced
this pull request
Feb 10, 2026
This was referenced Feb 11, 2026
This was referenced Feb 21, 2026
This was referenced Mar 2, 2026
This was referenced May 21, 2026
Open
Closed
Open
This was referenced Jun 2, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #703
Summary
WithDefaultLogMessageFormatter<T>()now acceptsSemanticLogMessageFormatterandDefaultLogMessageFormatter, which have private constructors (they use singletonInstanceproperties). The validation was too strict —GetConstructor([])only finds public constructors, but core Akka.NET'sSettings.csalready special-cases these types at runtime.WithDefaultLogMessageFormatter<T>()as[Obsolete]sinceSemanticLogMessageFormatteris now the default as of Akka.NET 1.5.58. The method still works for customILogMessageFormatterimplementations.Test plan
SemanticLogMessageFormatterShouldBeAcceptedTest— verifies the formatter is accepted and produces the correctSettings.LogFormatterDefaultLogMessageFormatterShouldBeAcceptedTest— same forDefaultLogMessageFormatterInvalidLogMessageFormatterThrowsTest— still rejects formatters without a public parameterless constructorTransformMessagesTest— custom formatters still work[Obsolete]attribute