Skip to content

Commit f9a2d2c

Browse files
committed
Enable SemanticLogMessageFormatter as default logger formatter
Changed the default logger formatter from DefaultLogMessageFormatter to SemanticLogMessageFormatter to enable semantic logging support by default. This allows both positional {0} and named {PropertyName} templates to work out of the box. Changes: - Updated akka.conf to use SemanticLogMessageFormatter as default - Added special case handling in Settings.cs for SemanticLogMessageFormatter singleton instance All 62 existing logger tests pass, confirming backward compatibility with positional templates while enabling new semantic logging capabilities.
1 parent 9d10594 commit f9a2d2c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/core/Akka/Actor/Settings.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ public Settings(ActorSystem system, Config config, ActorSystemSetup setup)
182182
{
183183
LogFormatter = DefaultLogMessageFormatter.Instance;
184184
}
185+
// SPECIAL CASE - check for the semantic log message formatter, which does not have an empty constructor (it's private)
186+
else if (logFormatType == typeof(SemanticLogMessageFormatter))
187+
{
188+
LogFormatter = SemanticLogMessageFormatter.Instance;
189+
}
185190
else
186191
{
187192
try

src/core/Akka/Configuration/akka.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ akka {
3232

3333
# Specifies the formatter used to format log messages. Can be customized
3434
# to use a different logging implementation, such as Serilog.
35-
logger-formatter = "Akka.Event.DefaultLogMessageFormatter, Akka"
35+
logger-formatter = "Akka.Event.SemanticLogMessageFormatter, Akka"
3636

3737
# Log level used by the configured loggers (see "loggers") as soon
3838
# as they have been started; before that, see "stdout-loglevel"

0 commit comments

Comments
 (0)