I want my Restassured request with spec get response status logged. My request is
given()
.spec(requestSpec)
.when()
.get("/" + userId)
.then()
.spec(responseSpec)
.extract().as(User.class)
;
My spec is
public static ResponseSpecification responseSpec = new ResponseSpecBuilder()
.expectStatusCode(200)
.log(STATUS)
.log(BODY)
.expectBody(notNullValue())
.build();
}
But there is no response status in the log unless I add .log().status() to my request.
Pls tell me how can I fix this.
UPDATE Following Ashish Patil advice I updated my request but without result
LogConfig logconfig = new LogConfig().enablePrettyPrinting(true);
RestAssured.config().logConfig(logconfig);
given()
.spec(requestSpec)
.when()
.get("/" + userId)
.then()
.spec(responseSpec)
.extract().as(User.class)
;