Replayable REST logs on spring-mvc

“What happens on this app ? I cannot figure out what these logs mean…”
That is one of the typical sentences we are likely to say when it comes to debugging in blackbox mode (without access to the code itself).

Although, there is one thing we all know : In a situation, the app creates some pieces of data and then send them to another object (whether it is a person or a service).

In some recent web architectures, with spring, we are likely to send REST requests to other services. We can customize how the data is sent and also how we should trace it.

The idea I want to underline is that a kind of logs that help is a “replayable log”, which means that someone looking at the code can try a request once more to understand a failing scenario, step by step, accurately

Then, why not curl logs ? A curl log syntax is really short, understandable and concise. It helps to understand how the data is being sent to another actor.

How to start ?
1. You can copy this gist into your app :
2. Add it inside your RestTemplate in your App Spring Configuration :

public RestTemplate thirdPartyServiceRestTemplate () {
final RestTemplate restTemplate = new RestTemplate();
restTemplate.setInterceptors(java.util.Collections.singletonList(new org.toilelibre.libe.logs.CurlLogHttpRequestInterceptor()));

return restTemplate ;

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.