You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ex...@apache.org on 2022/11/22 21:35:50 UTC

[nifi] 02/03: NIFI-10863 Added conditional InvokeHTTP HTTP debug log

This is an automated email from the ASF dual-hosted git repository.

exceptionfactory pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git

commit 6a9cb9c10ca6dd2624d8e337c78eeb605e232178
Author: Mike Thomsen <mt...@apache.org>
AuthorDate: Tue Nov 22 15:41:40 2022 -0500

    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 <ex...@apache.org>
---
 .../java/org/apache/nifi/processors/standard/InvokeHTTP.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
index 47c6037b20..affc21b118 100644
--- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
+++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java
@@ -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) {