mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Adding request-response logging to a file #405
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ZenwalkerD on GitHub (Feb 11, 2022).
I am using wiremock.net in my .NET CORE 5 project as shown:
I want to have a log written to a file; whenever /hello path is hit by any client. How to do this? I searched wiki and also library; i could not find.
Thanks
@StefH commented on GitHub (Feb 11, 2022):
@ZenwalkerD
Currently there is no logic or callback functionality implemented which allows this.
BTW: your question looks a lot like this one: #723
@StefH commented on GitHub (May 21, 2022):
@ZenwalkerD
Actually there is simple solution.
You can just implement your own logger, like:
https://github.com/WireMock-Net/WireMock.Net/blob/master/examples/WireMock.Net.Service/WireMockLog4NetLogger.cs
And you use the
public void DebugRequestResponse(LogEntryModel logEntryModel, bool isAdminRequest)to write the requests / responses.@ZenwalkerD commented on GitHub (May 23, 2022):
But which builder method should i use to do the invocation? In the code i have shown; none of then methods provdes any method which would give all the details like what is being returned; which http method, etc details.