ChrisSamo632 commented on code in PR #6712:
URL: https://github.com/apache/nifi/pull/6712#discussion_r1030838777
##########
nifi-nar-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java:
##########
@@ -790,6 +791,30 @@ private Response performRequest(final String method, final
String endpoint, fina
if (entity != null) {
request.setEntity(entity);
}
+
+ if (getLogger().isDebugEnabled()) {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ entity.writeTo(out);
+ out.close();
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("Dumping Elasticsearch REST request...\n")
+ .append("HTTP Method: ")
+ .append(method)
+ .append("\n")
+ .append("Endpoint: ")
+ .append(endpoint)
+ .append("\n")
+ .append("Parameters: ")
+
.append(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(parameters))
Review Comment:
Suggest creating the `Writer` a single time, e.g. in `onEnabled` after the
`mapper` has been initialised
Also, `builder` and `out` can be made `final`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]