You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2023/01/11 18:25:44 UTC
[GitHub] [nifi] MikeThomsen commented on a diff in pull request #6712: NIFI-10870 Wrapped debug logger statements with if statements in the …
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org