How to output generated request and response from Groovy RestClient?

I am currently using RestClient and cannot figure out how to output the xml and response xml request for debugging and informational purpose ...

I tried the solution mentioned here: http://agileice.blogspot.com/2009/09/pretty-printing-xml-results-returned.html

But that won't work, any other suggestions?

+8
rest groovy rest-client
source share
3 answers

Since this depends on the HTTPClient, you can try enabling header and wire logging for your script.

http://blog.techstacks.com/2009/12/configuring-wire-logging-in-groovy-httpbuilder.html

http://hc.apache.org/httpcomponents-client-ga/logging.html

+3
source share

The accepted answer (enable logging with log4j) is mostly correct, but I had a little problem with wired logging for the HTTP constructor in my Groovy script. For some reason, deleting the log4j.xml file in my $ GROOVY_HOME / conf directory does not work. Ultimately, I just had to add the appropriate logging options to the Groovy team when I ran it.

groovy -Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog -Dorg.apache.commons.logging.simplelog.showdatetime=true -Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG myscript.groovy 
+10
source share

If you use spring-boot you can set logging.level in the properties file of your application and use the slf4j part of slf4j .

 <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <version>${slf4j.version}</version> </dependency> <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>${logback.version}</version> </dependency> 
0
source share

All Articles