public static void enableLoggingOfRequestAndResponseIfValidationFails(LogDetail logDetail) {
        config = config == null ? new RestAssuredMockMvcConfig() : config;
        config = config.logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail));
        // Update request specification if already defined otherwise it'll override the configs.
        // Note that request spec also influence response spec when it comes to logging if validation fails due to the way filters work
        if (requestSpecification != null && requestSpecification instanceof MockMvcRequestSpecificationImpl) {
            RestAssuredMockMvcConfig restAssuredConfig = ((MockMvcRequestSpecificationImpl) requestSpecification).getRestAssuredMockMvcConfig();
            if (restAssuredConfig == null) {
                restAssuredConfig = config;
            } else {
                LogConfig logConfigForRequestSpec = restAssuredConfig.getLogConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail);
                restAssuredConfig = restAssuredConfig.logConfig(logConfigForRequestSpec);
            }
            requestSpecification.config(restAssuredConfig);
        }
    }
public static void enableLoggingOfRequestAndResponseIfValidationFails ( LogDetail logDetail ) { config = config == null ? new RestAssuredMockMvcConfig ( ) : config ; config = config . logConfig ( logConfig ( ) . enableLoggingOfRequestAndResponseIfValidationFails ( logDetail ) ) ; if ( requestSpecification != null && requestSpecification instanceof MockMvcRequestSpecificationImpl ) { RestAssuredMockMvcConfig restAssuredConfig = ( ( MockMvcRequestSpecificationImpl ) requestSpecification ) . getRestAssuredMockMvcConfig ( ) ; if ( restAssuredConfig == null ) { restAssuredConfig = config ; } else { LogConfig logConfigForRequestSpec = restAssuredConfig . getLogConfig ( ) . enableLoggingOfRequestAndResponseIfValidationFails ( logDetail ) ; restAssuredConfig = restAssuredConfig . logConfig ( logConfigForRequestSpec ) ; } requestSpecification . config ( restAssuredConfig ) ; } }
Enable logging of both the request and the response if REST Assureds test validation fails with the specified log detail.
<p/>
<p>
This is just a shortcut for:
</p>
<pre>
RestAssured.config = new RestAssuredMockMvcConfig().logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail));
</pre>

@param logDetail The log detail to show in the log