protected Response logAndRebufferResponse(
      String configKey, Level logLevel, Response response, long elapsedTime) throws IOException {
    String protocolVersion = resolveProtocolVersion(response.protocolVersion());
    String reason =
        response.reason() != null && logLevel.compareTo(Level.NONE) > 0
            ? " " + response.reason()
            : "";
    int status = response.status();
    log(configKey, "<--- %s %s%s (%sms)", protocolVersion, status, reason, elapsedTime);
    if (logLevel.ordinal() >= Level.HEADERS.ordinal()) {

      for (String field : response.headers().keySet()) {
        if (shouldLogResponseHeader(field)) {
          for (String value : valuesOrEmpty(response.headers(), field)) {
            log(configKey, "%s: %s", field, value);
          }
        }
      }

      int bodyLength = 0;
      if (response.body() != null && !(status == 204 || status == 205)) {
        // HTTP 204 No Content "...response MUST NOT include a message-body"
        // HTTP 205 Reset Content "...response MUST NOT include an entity"
        if (logLevel.ordinal() >= Level.FULL.ordinal()) {
          log(configKey, ""); // CRLF
        }
        byte[] bodyData = Util.toByteArray(response.body().asInputStream());
        ensureClosed(response.body());
        bodyLength = bodyData.length;
        if (logLevel.ordinal() >= Level.FULL.ordinal() && bodyLength > 0) {
          log(configKey, "%s", decodeOrDefault(bodyData, UTF_8, "Binary data"));
        }
        log(configKey, "<--- END HTTP (%s-byte body)", bodyLength);
        return response.toBuilder().body(bodyData).build();
      } else {
        log(configKey, "<--- END HTTP (%s-byte body)", bodyLength);
      }
    }
    return response;
  }
Override to filter out response headers.

@param header header name
@return true to log a response header
core/src/main/java/feign/Logger.java