mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
Disable debug logging in WireMock dotnet tool #463
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 @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
@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):
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....
@wolf8196 commented on GitHub (Nov 6, 2022):
@StefH
Just checked that version. All looks good to me. Thank you
@StefH commented on GitHub (Nov 6, 2022):
https://github.com/WireMock-Net/WireMock.Net/pull/845