Question on disabling console logging for Rest Assured request and response data.

715 views
Skip to first unread message

Mike Poz

unread,
Feb 5, 2020, 4:18:20 PM2/5/20
to REST assured
Hello!

We're using RestAssured in our api automation and some of our test suites have a very large amount of API calls which is logged to the console output.  We capture all the request and response information in a custom report, so we won't lose the information, however we want to disable the request and response data to the console output.

I've gone through the documentation and cannot find any way disable this.  Can anyone help with this?

Thanks!
Mike Poz

Michael Pinnegar

unread,
Feb 5, 2020, 8:10:44 PM2/5/20
to rest-a...@googlegroups.com
Much of the logging doesn't come from rest assured itself, but the underlying http client library. I customized the output of that apache client library by including a logback-test.xml (the name is important, that's how logback knows to use it if it's on the classpath) in my src/integration-test/resources/ folder.

AFAIK Apache client uses Log4j2 and you have to add a bridge library to intercept the normal Log4j2 calls and route them to logback instead. I looked through my Gradle configuration files and I didn't see any bridge dependencies, so I'm not sure exactly how the log files from the apache client are being routed into logback unless rest-assured comes with its own built in bridge dependency.

Bridge dependencies
 
I've attached my logback configuration file so you can see which parts I silenced.

Now that I've read your question again, how are you "capturing" this output? The "correct" way to do what you want would not be to use a custom library, but to use a xml configuration stanza with no console appender, and only a file appender.

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rest-assured/2e3fc18d-d838-40ff-a158-a7a680f2ce13%40googlegroups.com.
logback-xml..txt
Reply all
Reply to author
Forward
0 new messages