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

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

commit 6f473819cf52daf8da9e0bc34a50bcf2ead12336
Author: Otavio Rodolfo Piske <angusyo...@gmail.com>
AuthorDate: Thu Jan 5 16:55:19 2023 +0100

    (chores) camel-ftp: added log guards due to heavier call to removeServer
---
 .../file/remote/RemoteFilePollingConsumerPollStrategy.java   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
index ea77afc1ff4..c2e62bdfbcf 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFilePollingConsumerPollStrategy.java
@@ -34,14 +34,18 @@ public class RemoteFilePollingConsumerPollStrategy extends 
DefaultPollingConsume
             if (rfc.isRunAllowed()) {
                 // disconnect from the server to force it to re login at next
                 // poll to recover
-                log.warn("Trying to recover by force disconnecting from remote 
server and re-connecting at next poll: {}",
-                        rfc.remoteServer());
+                if (log.isWarnEnabled()) {
+                    log.warn("Trying to recover by force disconnecting from 
remote server and re-connecting at next poll: {}",
+                            rfc.remoteServer());
+                }
                 try {
                     rfc.forceDisconnect();
                 } catch (Throwable t) {
                     // ignore the exception
-                    log.debug("Error occurred during force disconnecting from: 
{}. This exception will be ignored.",
-                            rfc.remoteServer(), t);
+                    if (log.isDebugEnabled()) {
+                        log.debug("Error occurred during force disconnecting 
from: {}. This exception will be ignored.",
+                                rfc.remoteServer(), t);
+                    }
                 }
             }
         }

Reply via email to