Skip to content

Commit

Permalink
Fix exception logging
Browse files Browse the repository at this point in the history
These log messages are currently using this overload:

`void LogError(this ILogger logger, string message, params object[] args)`

But in order to correctly capture and enrich the log event with the exception, the following overload should be used:

`void LogError(this ILogger logger, Exception exception, string message, params object[] args)`.

Currently the exception isn't rendered as MSEL ignores props that have no equivalent holes.
  • Loading branch information
gkinsman authored and oskardudycz committed Oct 12, 2021
1 parent 0580cc3 commit e03ecc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Marten/Events/Daemon/HotColdCoordinator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private async Task<bool> tryToAttainLockAndStartShards()
{
conn?.SafeDispose();

_logger.LogError("Error trying to attain the async daemon lock", e);
_logger.LogError(e, "Error trying to attain the async daemon lock");
return false;
}

Expand All @@ -91,7 +91,7 @@ private async Task<bool> tryToAttainLockAndStartShards()
}
catch (Exception ex)
{
_logger.LogError("Failure while trying to start all async projection shards", ex);
_logger.LogError(ex, "Failure while trying to start all async projection shards");
}
}
else
Expand Down

0 comments on commit e03ecc8

Please sign in to comment.