-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
Bug: Example for WireMock as Windows Service throws Exception because of WireMockConsoleLogger #223
Comments
I'd be happy to submit a PR, if that's ok for you. |
Thanks for finding this bug. You can submit a PR where you just use the Or maybe better (however more work), create |
You're welcome. Thank you for maintaining this useful project! For now I fixed it by using the I agree with you that using an actual logger would be better and make sense. I'll consider to implement it and submit a separate PR for it as well. I'd tend to use a log4net-logger and configure something like an EventLogAppender and maybe an additional file appender. Would this basically match your thoughts? |
Correct. Just add a new WireMockEventLogger in the WireMock.Net.Service-project which can be based on log4net or just custom code to write to event log. |
Problem:
If I run the example for WireMock as a Windows Service, it throws the following exception on service startup:
Reason:
This is caused by the
WireMockConsoleLogger
which is also used if the application is actually running as a service. In this case the exception is thrown when the logger tries to access the console (which is actually not accessible in the service context).Possible solution:
Use the
WireMockConsoleLogger
only in case the application is running as console app and use theWireMockNullLogger
if it's running as service.Of course, this can be easily fixed and does therefore not present a major problem, but it would be nice if the example would just work out of the box without the need to fix this.
The text was updated successfully, but these errors were encountered: