Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
893 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 !

Also read: https://github.com/intuit/karate#report-verbosity


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...