NIFI-10863 Added conditional InvokeHTTP HTTP debug log

- Wrapping if statements prevent them from being called at all if debug logging is disabled

This closes #6706

Signed-off-by: David Handermann <exceptionfactory@apache.org>
This commit is contained in:
Mike Thomsen 2022-11-22 15:41:40 -05:00 committed by exceptionfactory
parent 8b71edd61a
commit 6a9cb9c10c
No known key found for this signature in database
GPG Key ID: 29B6A52D2AAE8DBA
1 changed files with 8 additions and 4 deletions

View File

@ -1299,13 +1299,17 @@ public class InvokeHTTP extends AbstractProcessor {
}
private void logRequest(ComponentLog logger, Request request) {
logger.debug("\nRequest to remote service:\n\t{}\n{}",
request.url().url().toExternalForm(), getLogString(request.headers().toMultimap()));
if (logger.isDebugEnabled()) {
logger.debug("\nRequest to remote service:\n\t{}\n{}",
request.url().url().toExternalForm(), getLogString(request.headers().toMultimap()));
}
}
private void logResponse(ComponentLog logger, URL url, Response response) {
logger.debug("\nResponse from remote service:\n\t{}\n{}",
url.toExternalForm(), getLogString(response.headers().toMultimap()));
if (logger.isDebugEnabled()) {
logger.debug("\nResponse from remote service:\n\t{}\n{}",
url.toExternalForm(), getLogString(response.headers().toMultimap()));
}
}
private String getLogString(Map<String, List<String>> map) {