{8.2.0-new} Logging and Debugging

The following methods provide logging of requests and responses:

The following example shows the results of logging all requests that end with /bean.

Examples:

// A simple bean we're going to round-trip. MyBean bean = new MyBean(); bean = RestClient .create() .simpleJson() .logRequests(DetailLevel.FULL, Level.SEVERE, (req,res)->req.getUri().endsWith("/bean")) .logToConsole() .build() .post("http://localhost/bean", bean) .run() .getBody().as(MyBean.class);

This produces the following console output:

=== HTTP Call (outgoing) ====================================================== === REQUEST === POST http://localhost/bean ---request headers--- Accept: application/json+simple ---request entity--- Content-Type: application/json+simple ---request content--- {f:1} === RESPONSE === HTTP/1.1 200 ---response headers--- Content-Type: application/json ---response content--- {f:1} === END =======================================================================",

It should be noted that if you enable request logging detail level {@link oaj.DetailLevel#FULL}, response bodies will be cached by default which may introduce a performance penalty.

Additionally, the following method is also provided for enabling debug mode:

Enabling debug mode has the following effects: