MikeThomsen commented on code in PR #6712:
URL: https://github.com/apache/nifi/pull/6712#discussion_r1067322336


##########
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:
   Making the change, but noting here that we both seem to agree that according 
to the docs it should be thread-safe:
   
   > Builder object that can be used for per-serialization configuration of 
serialization parameters, such as JSON View and root type to use. (and thus 
fully thread-safe with no external synchronization); new instances are 
constructed for different configurations. Instances are initially constructed 
by 
[ObjectMapper](https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/ObjectMapper.html)
 and can be reused in completely thread-safe manner with no explicit 
synchronization
   
   
[Source](https://fasterxml.github.io/jackson-databind/javadoc/2.7/com/fasterxml/jackson/databind/ObjectWriter.html)



-- 
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]

Reply via email to