rest-assured/src/main/java/io/restassured/RestAssured.java
public static void enableLoggingOfRequestAndResponseIfValidationFails(LogDetail logDetail) {
        LogConfig logConfig = LogConfig.logConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail);
        config = RestAssured.config().logConfig(logConfig);

        // 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 RequestSpecificationImpl) {
            RestAssuredConfig restAssuredConfig = ((RequestSpecificationImpl) requestSpecification).getConfig();
            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) {
        LogConfig logConfig = LogConfig.logConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail);
        config = RestAssured.config().logConfig(logConfig);

        // 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 RequestSpecificationImpl) {
            RestAssuredConfig restAssuredConfig = ((RequestSpecificationImpl) requestSpecification).getConfig();
            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 ) { LogConfig logConfig = LogConfig . logConfig ( ) . enableLoggingOfRequestAndResponseIfValidationFails ( logDetail ) ; config = RestAssured . config ( ) . logConfig ( logConfig ) ; // 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 RequestSpecificationImpl ) { RestAssuredConfig restAssuredConfig = ( ( RequestSpecificationImpl ) requestSpecification ) . getConfig ( ) ; 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 = RestAssured.config().logConfig(logConfig().enableLoggingOfRequestAndResponseIfValidationFails(logDetail));
</pre>

@param logDetail The log detail to show in the log
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 = RestAssured . config () . logConfig ( logConfig () . enableLoggingOfRequestAndResponseIfValidationFails ( logDetail )) ; < / pre >