diff --git a/examples/WireMock.Net.WebApplication.NET6/WireMockService.cs b/examples/WireMock.Net.WebApplication.NET6/WireMockService.cs
index 58bbdc14b..d35f9c970 100644
--- a/examples/WireMock.Net.WebApplication.NET6/WireMockService.cs
+++ b/examples/WireMock.Net.WebApplication.NET6/WireMockService.cs
@@ -52,9 +52,9 @@ public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminreques
_logger.LogDebug("Admin[{0}] {1}", isAdminrequest, message);
}
- public void Error(string formatString, Exception exception)
+ public void Error(string message, Exception exception)
{
- _logger.LogError(formatString, exception.Message);
+ _logger.LogError(exception, message);
}
}
diff --git a/src/WireMock.Net.TUnit/TUnitWireMockLogger.cs b/src/WireMock.Net.TUnit/TUnitWireMockLogger.cs
index a38926004..050c84ec0 100644
--- a/src/WireMock.Net.TUnit/TUnitWireMockLogger.cs
+++ b/src/WireMock.Net.TUnit/TUnitWireMockLogger.cs
@@ -51,9 +51,9 @@ public void Error(string formatString, params object[] args)
}
///
- public void Error(string formatString, Exception exception)
+ public void Error(string message, Exception exception)
{
- _tUnitLogger.LogError(Format("Error", formatString, exception.Message), exception);
+ _tUnitLogger.LogError(Format("Error", $"{message} {{0}}", exception));
if (exception is AggregateException ae)
{
diff --git a/src/WireMock.Net.xUnit/TestOutputHelperWireMockLogger.cs b/src/WireMock.Net.xUnit/TestOutputHelperWireMockLogger.cs
index df83bac37..0f0cbed2a 100644
--- a/src/WireMock.Net.xUnit/TestOutputHelperWireMockLogger.cs
+++ b/src/WireMock.Net.xUnit/TestOutputHelperWireMockLogger.cs
@@ -50,15 +50,15 @@ public void Error(string formatString, params object[] args)
}
///
- public void Error(string formatString, Exception exception)
+ public void Error(string message, Exception exception)
{
- _testOutputHelper.WriteLine(Format("Error", formatString, exception.Message));
+ _testOutputHelper.WriteLine(Format("Error", $"{message} {{0}}", exception));
if (exception is AggregateException ae)
{
ae.Handle(ex =>
{
- _testOutputHelper.WriteLine(Format("Error", "Exception {0}", ex.Message));
+ _testOutputHelper.WriteLine(Format("Error", "Exception {0}", ex));
return true;
});
}