Hi there! I have some troubles with wiremock, for ...
# help
t
Hi there! I have some troubles with wiremock, for example, when it returns a 500 error. but the response to the embedded answer is returned correctly. And I am a complete newbie in using this tool. Can you please tell me how and where the application logs are saved?
l
Would you be able to provide more information? How are you running WireMock? In your tests or standalone ? Could you show how you have setup your stubs etc? Normally, logs are just printed to the console. There is a verbose option that might help ( `--verbose`: Turn on verbose logging to stdout)
t
Thank you for the fast reply! I really appreciate it. Yeah, I will try to explain. Let's imagine we have a process flow where we need to call an external service over REST. We use WireMock to emulate it. When I get an error related to the mock, first of all I go to the DB that logs all these calls to the WireMock server. There I see the following details: request, response, status code, endpoint, attempts. This WireMock server is set up in a k8s deployment, so we have a pod running it. Sometimes problems occur. For example, as I described above: we send a request, we get a response with the expected correct body, BUT with a bad HTTP status code (500). I'm confused about this, because the problem was solved after restarting the pod, but I didn’t really investigate the error. So that was only a temporary solution. Of course, I need some info to debug it, and logs will help me. That’s why I’m here! ❤️
Normally, logs are just printed to the console.
Does it mean that I need to inspect stdout and stderr streams to understand historical results? (Assuming the pod is still alive.) And as I understand, verbose mode should be specified when starting the Java application? Generally logging will not work until we turn it on?
l
Yes, you will need to inspect the pod for the logs or wherever you stream your logs to from k8s (datadog etc) if you export them elsewhere. It is a little difficult to help much more than that without more information. How are you configuring wiremock with the stubs in the first place ? Are you using the wiremock json format that is loaded when the wiremock pod starts or are you adding stubs via the admin api after wiremock has started? It is a little confusing that the correct body would be returned but with a 500 response status. I am not sure that I have seen that before.