How to store logs for every API call in a separate text file

北战南征 提交于 2021-02-05 09:44:30

问题


Using Karate i am making API calls sequentially. I need to store API request and response for this sequential flow of APIs in separate text files for each API call. Need to understand how can i achieve this.

I have tried logback which stores entire execution logs in a text file.


回答1:


Take a look at karate.prevRequest which will give you the "request". Now use some custom Java (or JS) code and write whatever you want to a file.

I think personally it is un-necessary because Karate's HTML report has all that you need. If someone is asking you to do this, please try convince that person that this exercise is a waste of time.



来源:https://stackoverflow.com/questions/57474109/how-to-store-logs-for-every-api-call-in-a-separate-text-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!