Logging HttpBuilder traffic

Groovy and HttpBuilder are a nice way to write quick scripts to exercise web services. It’s especially useful when it’s just a bit too complex for something like curl. Unfortunately, there’s no quick way to trace all the I/O as with curl’s –trace, but turning on logging isn’t too difficult.

HttpBuilder uses HttpClient, which does some logging with Apache’s commons-logging. Without any additional libraries or configuration, it will fall back on Java’s java.util.logging package. Java expects it’s logging configuration in a properties file. Here’s a minimal config:


Launch groovy with the right system property, and all the output will be logged.

groovy -Djava.util.logging.config.file=logging.properties \

Comments are closed.