Disable debug logging in WireMock dotnet tool #463

Closed
opened 2025-12-29 15:24:27 +01:00 by adam · 4 comments
Owner

Originally created by @wolf8196 on GitHub (Nov 5, 2022).

Originally assigned to: @StefH on GitHub.

Hi.
Is there a way to set log level in WireMock dotnet tool to disable debug messages?
Or disable logging entirely?
It's useful to see request/response when you are setting everything up, but once that's done, those logs are just spam.

From what I understand the logger currently is created in Program.cs with debug level & passed into StandAloneApp logic.
49b29d74dc/src/dotnet-WireMock.Net/Program.cs (L23)

And here
49b29d74dc/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs (L65)

The "logger is not null" check will always be true & just reassign the logger, without possibility to override it with console arguments.
And also there is only check for WireMockConsoleLogger, and no way to use the WireMockNullLogger, that probably disables the logging.

Please let me know if I missed something, or of any other way to get rid of request/response logging.
Thank you

Originally created by @wolf8196 on GitHub (Nov 5, 2022). Originally assigned to: @StefH on GitHub. Hi. Is there a way to set log level in WireMock dotnet tool to disable debug messages? Or disable logging entirely? It's useful to see request/response when you are setting everything up, but once that's done, those logs are just spam. From what I understand the logger currently is created in Program.cs with debug level & passed into StandAloneApp logic. https://github.com/WireMock-Net/WireMock.Net/blob/49b29d74dcc54171a6bb31817cf305a06e1f1018/src/dotnet-WireMock.Net/Program.cs#L23 And here https://github.com/WireMock-Net/WireMock.Net/blob/49b29d74dcc54171a6bb31817cf305a06e1f1018/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs#L65 The "logger is not null" check will always be true & just reassign the logger, without possibility to override it with console arguments. And also there is only check for WireMockConsoleLogger, and no way to use the WireMockNullLogger, that probably disables the logging. Please let me know if I missed something, or of any other way to get rid of request/response logging. Thank you
adam added the question label 2025-12-29 15:24:27 +01:00
adam closed this issue 2025-12-29 15:24:28 +01:00
Author
Owner

@StefH commented on GitHub (Nov 6, 2022):

@wolf8196
I understand your question, and I've added support for WireMockNullLogger in the command line tool.

Please try preview version: 1.5.9-ci-16630

(https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)

@StefH commented on GitHub (Nov 6, 2022): @wolf8196 I understand your question, and I've added support for WireMockNullLogger in the command line tool. Please try preview version: `1.5.9-ci-16630` (https://github.com/WireMock-Net/WireMock.Net/wiki/MyGet-preview-versions)
Author
Owner

@StefH commented on GitHub (Nov 6, 2022):

The reason I've created an own simple logging class in WireMock, is that I cannot use Microsoft.Extensions.Logging.Abstractions because I'm still supporting older frameworks like 4.5.2 & 4.6

I need to think on this....

@StefH commented on GitHub (Nov 6, 2022): The reason I've created an own simple logging class in WireMock, is that I cannot use Microsoft.Extensions.Logging.Abstractions because I'm still supporting older frameworks like 4.5.2 & 4.6 I need to think on this....
Author
Owner

@wolf8196 commented on GitHub (Nov 6, 2022):

@StefH
Just checked that version. All looks good to me. Thank you

@wolf8196 commented on GitHub (Nov 6, 2022): @StefH Just checked that version. All looks good to me. Thank you
Author
Owner

@StefH commented on GitHub (Nov 6, 2022):

https://github.com/WireMock-Net/WireMock.Net/pull/845

@StefH commented on GitHub (Nov 6, 2022): https://github.com/WireMock-Net/WireMock.Net/pull/845
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#463