空手道:有没有办法在使用重试时禁用日志? [英] Karate: Is there a way to disable log when using retry?

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

问题描述

我使用 Karate 进行验证测试.

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 请求并从 Karate 调用它.

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 !

另请阅读:https://github.com/intuit/karate#report-verbosity

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

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