Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WireMock Standalone - null reference exception since settings.Logger #412

Closed
larsbrekken opened this issue Feb 1, 2020 · 3 comments
Closed
Labels

Comments

@larsbrekken
Copy link

Two observations about the documentation at
https://github.com/WireMock-Net/WireMock.Net/wiki/WireMock-as-a-standalone-process

  1. The page lists the argument --WireMockConsoleLogger, however the correct name is WireMockLogger. See https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Settings/WireMockServerSettingsParser.cs#L46-L49

  2. The page also says that the default logger is WireMockNullLogger, however if you try not to supply a logger you get a null reference exception since settings.Logger remains null and a line in StandAloneApp tries to use it:
    https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net.StandAlone/StandAloneApp.cs#L43

@StefH
Copy link
Collaborator

StefH commented Feb 2, 2020

  1. OK: updated

  2. This is indeed a bug. If there is no logger, you cannot log.
    What would be solution?

  • only log that debug statement when a logger is present
  • else use console.writeline ?

@larsbrekken
Copy link
Author

Thanks Stef.

For 2, if the default is WireMockNullLogger it seems ok not to log at all if the consumer has not specified a logger, at least that would be my expectation. So my vote would be to only log that statement when a logger is present.

@StefH StefH added the bug label Feb 5, 2020
@StefH StefH changed the title Standalone documentation is incorrect WireMock Standalone - null reference exception since settings.Logger Feb 5, 2020
@StefH
Copy link
Collaborator

StefH commented Feb 5, 2020

#414

@StefH StefH closed this as completed Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants