空手道:使用重试时是否可以禁用日志? [英] Karate: Is there a way to disable log when using retry?

查看:56
本文介绍了空手道:使用重试时是否可以禁用日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用空手道进行验证测试.

I'm using Karate for validation tests.

我对我的一个请求设置了一个重试,但有时会进行100次以上的重试,这会在每个请求上创建具有相同大有效负载的大型无用日志... 这使我的CI膨胀了.

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 ?

我已经尝试过* configure report = false,但这仅对Cucumber html报告禁用. 我也想在STDOUT控制台中禁用它.

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

所以也许可以通过logback-test.xml中设置的某种日志级别操纵形式?

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

谢谢.

推荐答案

不,您不禁用每个请求的日志,可以通过将日志级别设置为INFO来关闭所有内容-但我想您不想要那. 100次重试对我来说听起来很不寻常.您可以通过功能请求来尝试自己的运气-但我可以告诉您,除非有人提供代码,否则这将是低优先级.

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.

如果这确实使您感到困扰,请编写一些自定义Java代码来执行此轮询+ HTTP请求,然后从空手道中调用它.

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

我想我有一个适合您的解决方案.您可以完全禁用控制台上显示的空手道日志-在将HTML报告更改为logback-test.xml:

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 !

这篇关于空手道:使用重试时是否可以禁用日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆