feat: add semantic logging support for Akka.NET 1.5.56+#693
Merged
Arkatufus merged 6 commits intoDec 3, 2025
Merged
Conversation
Enhances LoggerFactoryLogger to leverage Akka.NET's new semantic logging
APIs introduced in version 1.5.56. This change enables Microsoft.Extensions
.Logging (MEL) to receive full structured logging context with proper state
dictionaries instead of pre-formatted strings.
Changes:
- Completely rewrote LoggerFactoryLogger.Log() method to use semantic logging
- Extracts structured properties into MEL state dictionary
- Adds {OriginalFormat} key per MEL convention for template preservation
- Includes Akka metadata (ActorPath, Timestamp, Thread, LogSource)
- Added comprehensive test suite (SemanticLoggingSpecs.cs) with 7 tests covering:
* Named and positional template properties
* Multiple properties handling
* Akka metadata preservation
* {OriginalFormat} key verification
* Format specifiers handling
* Empty properties handling
All existing tests pass (457/458, 1 skipped - same as before).
## Impact
MEL sinks (Serilog, Seq, Application Insights, etc.) now receive properly
structured state dictionaries, enabling:
- Query by structured property values
- Correlation across log entries
- Rich dashboard visualizations
- Better log analysis and filtering
Example MEL state dictionary:
{
"UserId": 12345,
"Email": "user@example.com",
"ActorPath": "akka://sys/user/myactor",
"Timestamp": <DateTime>,
"Thread": 17,
"LogSource": "MyActor",
"{OriginalFormat}": "User {UserId} with email {Email} logged in"
}
Depends on: Akka.NET >= 1.5.56
- Replaced all 7 instances of await Task.Delay(500) with AwaitAssertAsync() - Added AwaitAssertAsync helper method that implements retry pattern for assertions - Fixes anti-pattern of using arbitrary delays in async tests - Tests now properly wait for conditions to be met rather than hoping 500ms is enough
- Updated Akka.NET dependency from 1.5.55 to 1.5.56 - Required for semantic logging API support
6 tasks
This was referenced Dec 17, 2025
This was referenced Dec 31, 2025
This was referenced Jan 7, 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.
Summary
Adds semantic logging support to leverage Akka.NET's new semantic logging APIs introduced in version 1.5.56.
This major enhancement enables Microsoft.Extensions.Logging (MEL) to receive properly structured state dictionaries instead of pre-formatted strings, unlocking the full power of structured logging for all MEL sinks (Serilog, Seq, Application Insights, etc.).
Changes
Test Coverage
New test suite includes:
All existing tests pass (457/458, 1 skipped - same as before).
Impact
This change enables MEL sinks to:
Example State Dictionary
Before: MEL received formatted string "User 12345 with email user@example.com logged in"
After: MEL receives structured state:
Backwards Compatibility
Fully backwards compatible through conditional TryGetProperties() check. Falls back to ToString() for non-structured messages.
Dependencies
Requires Akka.NET >= 1.5.56 (not yet released)
Notes