Karate: Is there a way to disable log when using retry?

女生的网名这么多〃 提交于 2020-12-26 03:18:46

问题


I'm using Karate for validation tests.

I setup a retry on one of my request but sometimes there is more than 100 retry, this create to big useless logs with the same big payload on each request... And this bloat my CI.

I want to reduce this logs quantity, maybe by disable log for just this request ?

I've tried * configure report = false but this disable only on Cucumber html report. I want to disable also in STDOUT console.

So maybe with some form of log level manipulation setted in the logback-test.xml ?

Thanks.


回答1:


No you con't disable logs per request, you can switch off everything by setting the log level to INFO - but I guess you don't want that. 100 retries sounds very unusual to me. You can try your luck with a feature request - but I can tell you that this would be low priority unless someone contributes code.

If this really bothers you, write some custom Java code to do this polling + HTTP request and call it from Karate.

EDIT: I think I have a solution that will work for you. You can completely disable the Karate logs appearing on the console - while still having the HTML report with this change to the logback-test.xml:

<root level="warn">
    <!-- <appender-ref ref="STDOUT" /> -->
    <appender-ref ref="FILE" />
</root>

So just commenting out the console log appender will do the trick !



来源:https://stackoverflow.com/questions/56937370/karate-is-there-a-way-to-disable-log-when-using-retry

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