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

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


The following commit(s) were added to refs/heads/main by this push:
     new 5f7242e  (chores) logging cleanups (other components) (#7178)
5f7242e is described below

commit 5f7242e38d9f6955acde00ac1b7492a25b90a879
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Wed Mar 9 20:34:33 2022 +0100

    (chores) logging cleanups (other components) (#7178)
    
    * (chores) camel-barcode: minor log adjustments to avoid potential 
performance penalties
    
    * (chores) camel-box: use log guards to avoid creating transient objects
    
    * (chores) camel-cm-sms: minor log adjustments to avoid potential 
performance penalties
    
    * (chores) camel-cometd: minor log adjustments to avoid potential 
performance penalties
    
    * (chores) camel-drill: use log guards to avoid creating transient objects
    
    * (chores) camel-ftp: use log guards to avoid creating transient objects
    
    * (chores) camel-influxdb: use log guards to avoid creating transient 
objects
    
    * (chores) camel-jasypt: minor log adjustments to avoid potential 
performance penalties
    
    * (chores) camel-jsch: use log guards to avoid creating transient objects
    
    * (chores) camel-zookeeper: minor log adjustments to avoid potential 
performance penalties
---
 .../dataformat/barcode/BarcodeDataFormat.java      | 10 ++---
 .../camel/component/box/api/BoxFoldersManager.java | 16 ++++++--
 .../org/apache/camel/component/cm/CMProducer.java  |  2 +-
 .../camel/component/cometd/CometdBinding.java      |  6 +--
 .../camel/component/drill/DrillProducer.java       |  4 +-
 .../camel/component/file/remote/FtpOperations.java |  4 +-
 .../component/file/remote/RemoteFileConsumer.java  |  2 +-
 .../component/file/remote/SftpOperations.java      |  9 ++++-
 .../camel/component/influxdb/InfluxDbProducer.java |  8 +++-
 .../component/jasypt/JasyptPropertiesParser.java   | 10 ++---
 .../apache/camel/component/scp/ScpOperations.java  | 16 ++++++--
 .../component/zookeeper/ZooKeeperProducer.java     | 45 ++++++++--------------
 .../zookeeper/cloud/ZooKeeperServiceRegistry.java  |  8 ++--
 .../zookeeper/cluster/ZooKeeperClusterService.java |  8 ++--
 14 files changed, 84 insertions(+), 64 deletions(-)

diff --git 
a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
 
b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
index 158c2c1..a0ab25a 100644
--- 
a/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
+++ 
b/components/camel-barcode/src/main/java/org/apache/camel/dataformat/barcode/BarcodeDataFormat.java
@@ -240,7 +240,7 @@ public class BarcodeDataFormat extends ServiceSupport 
implements DataFormat, Dat
      */
     public final void addToHintMap(final EncodeHintType hintType, final Object 
value) {
         this.writerHintMap.put(hintType, value);
-        LOG.info(String.format("Added '%s' with value '%s' to writer hint 
map.", hintType.toString(), value.toString()));
+        LOG.info("Added '{}' with value '{}' to writer hint map.", hintType, 
value);
     }
 
     /**
@@ -256,9 +256,9 @@ public class BarcodeDataFormat extends ServiceSupport 
implements DataFormat, Dat
     public final void removeFromHintMap(final EncodeHintType hintType) {
         if (this.writerHintMap.containsKey(hintType)) {
             this.writerHintMap.remove(hintType);
-            LOG.info(String.format("Removed '%s' from writer hint map.", 
hintType.toString()));
+            LOG.info("Removed '{}' from writer hint map.", hintType);
         } else {
-            LOG.warn(String.format("Could not find encode hint type '%s' in 
writer hint map.", hintType.toString()));
+            LOG.warn("Could not find encode hint type '{}' in writer hint 
map.", hintType);
         }
     }
 
@@ -268,9 +268,9 @@ public class BarcodeDataFormat extends ServiceSupport 
implements DataFormat, Dat
     public final void removeFromHintMap(final DecodeHintType hintType) {
         if (this.readerHintMap.containsKey(hintType)) {
             this.readerHintMap.remove(hintType);
-            LOG.info(String.format("Removed '%s' from reader hint map.", 
hintType.toString()));
+            LOG.info("Removed '{}' from reader hint map.", hintType);
         } else {
-            LOG.warn(String.format("Could not find decode hint type '%s' in 
reader hint map.", hintType.toString()));
+            LOG.warn("Could not find decode hint type '{}' in reader hint 
map.", hintType);
         }
     }
 
diff --git 
a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
 
b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
index d0c2f41..488ed7d 100644
--- 
a/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
+++ 
b/components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFoldersManager.java
@@ -76,7 +76,9 @@ public class BoxFoldersManager {
      */
     public BoxFolder getFolder(String... path) {
         try {
-            LOG.debug("Getting folder at path={}", Arrays.toString(path));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Getting folder at path={}", Arrays.toString(path));
+            }
 
             BoxFolder folder = BoxFolder.getRootFolder(boxConnection);
             if (path == null || path.length == 0) {
@@ -114,8 +116,10 @@ public class BoxFoldersManager {
      */
     public Collection<BoxItem.Info> getFolderItems(String folderId, Long 
offset, Long limit, String... fields) {
         try {
-            LOG.debug("Getting folder items in folder(id={}) at offset={} and 
limit={} with fields={}",
-                    folderId, offset, limit, Arrays.toString(fields));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Getting folder items in folder(id={}) at offset={} 
and limit={} with fields={}",
+                        folderId, offset, limit, Arrays.toString(fields));
+            }
             if (folderId == null) {
                 throw new IllegalArgumentException("Parameter 'folderId' can 
not be null");
             }
@@ -179,7 +183,11 @@ public class BoxFoldersManager {
      */
     public BoxFolder createFolder(String parentFolderId, String... path) {
         try {
-            LOG.debug("Creating folder with path '{}' in 
parent_folder(id={})", Arrays.toString(path), parentFolderId);
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Creating folder with path '{}' in 
parent_folder(id={})", Arrays.toString(path), parentFolderId);
+            }
+
             if (parentFolderId == null) {
                 throw new IllegalArgumentException("Parameter 'parentFolderId' 
can not be null");
             }
diff --git 
a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
 
b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
index c95c30e..f6b4684 100644
--- 
a/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
+++ 
b/components/camel-cm-sms/src/main/java/org/apache/camel/component/cm/CMProducer.java
@@ -68,7 +68,7 @@ public class CMProducer extends DefaultProducer {
             for (final ConstraintViolation<SMSMessage> cv : 
constraintViolations) {
                 msg.append(String.format("- Invalid value for %s: %s", 
cv.getPropertyPath().toString(), cv.getMessage()));
             }
-            LOG.debug(msg.toString());
+            LOG.debug("SMS message: {}", msg);
             throw new InvalidPayloadRuntimeException(exchange, 
SMSMessage.class);
         }
         LOG.trace("SMSMessage instance is valid: {}", smsMessage);
diff --git 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
index d361583..ffa804d 100644
--- 
a/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
+++ 
b/components/camel-cometd/src/main/java/org/apache/camel/component/cometd/CometdBinding.java
@@ -42,8 +42,6 @@ public class CometdBinding {
     public static final String COMETD_SUBSCRIPTION_HEADER_NAME = 
"subscription";
     public static final String COMETD_SESSION_ATTR_HEADER_NAME = 
"CometdSessionAttr";
 
-    private static final String IMPROPER_SESSTION_ATTRIBUTE_TYPE_MESSAGE
-            = "Sesstion attribute %s has a value of %s which cannot be 
included as at header because it is not an int, string, or long.";
     private static final Logger LOG = 
LoggerFactory.getLogger(CometdBinding.class);
 
     private final BayeuxServerImpl bayeux;
@@ -105,7 +103,9 @@ public class CometdBinding {
                 message.setHeader(attributeName, attribute);
             } else {
                 // Do we need to support other type of session objects ?
-                
LOG.info(String.format(IMPROPER_SESSTION_ATTRIBUTE_TYPE_MESSAGE, attributeName, 
attribute));
+                LOG.info(
+                        "Session attribute {} has a value of {} which cannot 
be included as at header because it is not an int, string, or long.",
+                        attributeName, attribute);
             }
 
         }
diff --git 
a/components/camel-drill/src/main/java/org/apache/camel/component/drill/DrillProducer.java
 
b/components/camel-drill/src/main/java/org/apache/camel/component/drill/DrillProducer.java
index a662894..7a36e02 100644
--- 
a/components/camel-drill/src/main/java/org/apache/camel/component/drill/DrillProducer.java
+++ 
b/components/camel-drill/src/main/java/org/apache/camel/component/drill/DrillProducer.java
@@ -87,7 +87,9 @@ public class DrillProducer extends DefaultProducer {
     private void createJDBCConnection() throws ClassNotFoundException, 
SQLException {
         Class.forName(DrillConstants.DRILL_DRIVER);
 
-        LOG.info("connection url: {}", endpoint.toJDBCUri());
+        if (LOG.isInfoEnabled()) {
+            LOG.info("connection url: {}", endpoint.toJDBCUri());
+        }
 
         this.connection = DriverManager.getConnection(endpoint.toJDBCUri());
     }
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
index c8bf472..b1da0ec 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java
@@ -249,7 +249,9 @@ public class FtpOperations implements 
RemoteFileOperations<FTPFile> {
         final int port = configuration.getPort();
 
         try {
-            log.trace("Reconnect attempt to {}", 
configuration.remoteServerInformation());
+            if (log.isTraceEnabled()) {
+                log.trace("Reconnect attempt to {}", 
configuration.remoteServerInformation());
+            }
 
             clientActivityListener.onConnecting(host);
             client.connect(host, port);
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index 0d5e27d..9b14862 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -229,7 +229,7 @@ public abstract class RemoteFileConsumer<T> extends 
GenericFileConsumer<T> {
                 LOG.debug("Not connected/logged in, connecting to: {}", 
remoteServer());
             }
             loggedIn = getOperations().connect((RemoteFileConfiguration) 
endpoint.getConfiguration(), null);
-            if (loggedIn) {
+            if (loggedIn && LOG.isDebugEnabled()) {
                 LOG.debug("Connected and logged in to: {}", remoteServer());
             }
         }
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index f1ae2ec..26fd3ad 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -144,7 +144,9 @@ public class SftpOperations implements 
RemoteFileOperations<SftpRemoteFile> {
     }
 
     private boolean tryConnect(TaskPayload payload) {
-        LOG.trace("Reconnect attempt to {}", 
payload.configuration.remoteServerInformation());
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("Reconnect attempt to {}", 
payload.configuration.remoteServerInformation());
+        }
 
         try {
             if (channel == null || !channel.isConnected()) {
@@ -172,7 +174,10 @@ public class SftpOperations implements 
RemoteFileOperations<SftpRemoteFile> {
                     LOG.trace("Connecting ...");
                     channel.connect();
                 }
-                LOG.debug("Connected to {}", 
payload.configuration.remoteServerInformation());
+
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Connected to {}", 
payload.configuration.remoteServerInformation());
+                }
             }
         } catch (JSchException e) {
             payload.exception = e;
diff --git 
a/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
 
b/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
index ef0c1cf..69cf754 100644
--- 
a/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
+++ 
b/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
@@ -77,7 +77,9 @@ public class InfluxDbProducer extends DefaultProducer {
         if (!endpoint.isBatch()) {
             Point p = exchange.getIn().getMandatoryBody(Point.class);
             try {
-                LOG.debug("Writing point {}", p.lineProtocol());
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Writing point {}", p.lineProtocol());
+                }
                 connection.write(dataBaseName, retentionPolicy, p);
             } catch (Exception ex) {
                 exchange.setException(new CamelInfluxDbException(ex));
@@ -85,7 +87,9 @@ public class InfluxDbProducer extends DefaultProducer {
         } else {
             BatchPoints batchPoints = 
exchange.getIn().getMandatoryBody(BatchPoints.class);
             try {
-                LOG.debug("Writing BatchPoints {}", 
batchPoints.lineProtocol());
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Writing BatchPoints {}", 
batchPoints.lineProtocol());
+                }
                 connection.write(batchPoints);
             } catch (Exception ex) {
                 exchange.setException(new CamelInfluxDbException(ex));
diff --git 
a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/JasyptPropertiesParser.java
 
b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/JasyptPropertiesParser.java
index 14ff4cc..8715243 100644
--- 
a/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/JasyptPropertiesParser.java
+++ 
b/components/camel-jasypt/src/main/java/org/apache/camel/component/jasypt/JasyptPropertiesParser.java
@@ -26,8 +26,6 @@ import org.apache.camel.util.StringHelper;
 import org.jasypt.encryption.StringEncryptor;
 import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
 
-import static java.lang.String.format;
-
 /**
  * A {@link org.apache.camel.component.properties.PropertiesParser} which is 
using
  * &nbsp;<a href="http://www.jasypt.org/";>Jasypt</a> to decrypt encrypted 
values.
@@ -52,12 +50,14 @@ public class JasyptPropertiesParser extends 
DefaultPropertiesParser {
 
     @Override
     public String parseProperty(String key, String value, PropertiesLookup 
properties) {
-        log.trace(format("Parsing property '%s=%s'", key, value));
+        log.trace("Parsing property '{}={}'", key, value);
         if (value != null) {
             initEncryptor();
             Matcher matcher = PATTERN.matcher(value);
             while (matcher.find()) {
-                log.trace(format("Decrypting part '%s'", matcher.group(0)));
+                if (log.isTraceEnabled()) {
+                    log.trace("Decrypting part '{}'", matcher.group(0));
+                }
                 String decrypted = encryptor.decrypt(matcher.group(1));
                 value = value.replace(matcher.group(0), decrypted);
             }
@@ -72,7 +72,7 @@ public class JasyptPropertiesParser extends 
DefaultPropertiesParser {
             pbeStringEncryptor.setPassword(password);
             if (algorithm != null) {
                 pbeStringEncryptor.setAlgorithm(algorithm);
-                log.debug(format("Initialized encryptor using %s algorithm and 
provided password", algorithm));
+                log.debug("Initialized encryptor using {} algorithm and 
provided password", algorithm);
             } else {
                 log.debug("Initialized encryptor using default algorithm and 
provided password");
             }
diff --git 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
index 0a183e7..eaf30f5 100644
--- 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
+++ 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
@@ -125,7 +125,9 @@ public class ScpOperations implements 
RemoteFileOperations<ScpFile> {
             channel = (ChannelExec) session.openChannel("exec");
             channel.setCommand(getScpCommand(cfg, file));
             channel.connect(timeout);
-            LOG.trace("Channel connected to {}", 
cfg.remoteServerInformation());
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Channel connected to {}", 
cfg.remoteServerInformation());
+            }
 
             try {
                 if (is == null) {
@@ -147,7 +149,10 @@ public class ScpOperations implements 
RemoteFileOperations<ScpFile> {
                 LOG.trace("Disconnecting 'exec' scp channel");
                 channel.disconnect();
                 channel = null;
-                LOG.trace("Channel disconnected from {}", 
cfg.remoteServerInformation());
+
+                if (LOG.isTraceEnabled()) {
+                    LOG.trace("Channel disconnected from {}", 
cfg.remoteServerInformation());
+                }
             }
         }
         return true;
@@ -311,8 +316,11 @@ public class ScpOperations implements 
RemoteFileOperations<ScpFile> {
             }
 
             int timeout = config.getConnectTimeout();
-            LOG.debug("Connecting to {} with {} timeout...", 
config.remoteServerInformation(),
-                    timeout > 0 ? (Integer.toString(timeout) + " ms") : "no");
+
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Connecting to {} with {} timeout...", 
config.remoteServerInformation(),
+                        timeout > 0 ? (timeout + " ms") : "no");
+            }
             if (timeout > 0) {
                 session.connect(timeout);
             } else {
diff --git 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
index f4f93ba..d3f9664 100644
--- 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
+++ 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperProducer.java
@@ -34,7 +34,6 @@ import org.apache.zookeeper.data.Stat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static java.lang.String.format;
 import static 
org.apache.camel.component.zookeeper.ZooKeeperUtils.getAclListFromMessage;
 import static 
org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateMode;
 import static 
org.apache.camel.component.zookeeper.ZooKeeperUtils.getCreateModeFromString;
@@ -77,9 +76,7 @@ public class ZooKeeperProducer extends DefaultProducer {
 
         if (ExchangeHelper.isOutCapable(exchange)) {
             if (isDelete) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(format("Deleting znode '%s', waiting for 
confirmation", context.node));
-                }
+                LOG.debug("Deleting znode '{}', waiting for confirmation", 
context.node);
 
                 OperationResult result = synchronouslyDelete(context);
                 if (configuration.isListChildren()) {
@@ -87,9 +84,7 @@ public class ZooKeeperProducer extends DefaultProducer {
                 }
                 updateExchangeWithResult(context, result);
             } else {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(format("Storing data to znode '%s', waiting for 
confirmation", context.node));
-                }
+                LOG.debug("Storing data to znode '{}', waiting for 
confirmation", context.node);
 
                 OperationResult result = synchronouslySetData(context);
                 if (configuration.isListChildren()) {
@@ -111,7 +106,7 @@ public class ZooKeeperProducer extends DefaultProducer {
     protected void doStart() throws Exception {
         connection = zkm.getConnection();
         if (LOG.isTraceEnabled()) {
-            LOG.trace(String.format("Starting zookeeper producer of '%s'", 
configuration.getPath()));
+            LOG.trace("Starting zookeeper producer of '{}'", 
configuration.getPath());
         }
     }
 
@@ -119,23 +114,21 @@ public class ZooKeeperProducer extends DefaultProducer {
     protected void doStop() throws Exception {
         super.doStop();
         if (LOG.isTraceEnabled()) {
-            LOG.trace(String.format("Shutting down zookeeper producer of 
'%s'", configuration.getPath()));
+            LOG.trace("Shutting down zookeeper producer of '{}'", 
configuration.getPath());
         }
         zkm.shutdown();
     }
 
     private void asynchronouslyDeleteNode(ZooKeeper connection, 
ProductionContext context) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug(format("Deleting node '%s', not waiting for 
confirmation", context.node));
-        }
+        LOG.debug("Deleting node '{}', not waiting for confirmation", 
context.node);
+
         connection.delete(context.node, context.version, new 
AsyncDeleteCallback(), context);
 
     }
 
     private void asynchronouslySetDataOnNode(ZooKeeper connection, 
ProductionContext context) {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug(format("Storing data to node '%s', not waiting for 
confirmation", context.node));
-        }
+        LOG.debug("Storing data to node '{}', not waiting for confirmation", 
context.node);
+
         connection.setData(context.node, context.payload, context.version, new 
AsyncSetDataCallback(), context);
     }
 
@@ -180,17 +173,17 @@ public class ZooKeeperProducer extends DefaultProducer {
         public void processResult(int rc, String node, Object ctx, Stat 
statistics) {
             if (Code.NONODE.equals(Code.get(rc))) {
                 if (configuration.isCreate()) {
-                    LOG.warn(format("Node '%s' did not exist, creating it...", 
node));
+                    LOG.warn("Node '{}' did not exist, creating it...", node);
                     ProductionContext context = (ProductionContext) ctx;
                     OperationResult<String> result = null;
                     try {
                         result = createNode(context);
                     } catch (Exception e) {
-                        LOG.error(format("Error trying to create node '%s'", 
node), e);
+                        LOG.error("Error trying to create node '{}'", node, e);
                     }
 
                     if (result == null || !result.isOk()) {
-                        LOG.error(format("Error creating node '%s'", node), 
result.getException());
+                        LOG.error("Error creating node '{}'", node, 
result.getException());
                     }
                 }
             } else {
@@ -202,13 +195,7 @@ public class ZooKeeperProducer extends DefaultProducer {
     private class AsyncDeleteCallback implements VoidCallback {
         @Override
         public void processResult(int rc, String path, Object ctx) {
-            if (LOG.isDebugEnabled()) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace(format("Removed data node '%s'", path));
-                } else {
-                    LOG.debug(format("Removed data node '%s'", path));
-                }
-            }
+            LOG.debug("Removed data node '{}'", path);
         }
     }
 
@@ -242,7 +229,7 @@ public class ZooKeeperProducer extends DefaultProducer {
         OperationResult result = setData.get();
 
         if (!result.isOk() && configuration.isCreate() && 
result.failedDueTo(Code.NONODE)) {
-            LOG.warn(format("Node '%s' did not exist, creating it.", 
ctx.node));
+            LOG.warn("Node '{}' did not exist, creating it.", ctx.node);
             result = createNode(ctx);
         }
         return result;
@@ -255,7 +242,7 @@ public class ZooKeeperProducer extends DefaultProducer {
         OperationResult result = setData.get();
 
         if (!result.isOk() && configuration.isCreate() && 
result.failedDueTo(Code.NONODE)) {
-            LOG.warn(format("Node '%s' did not exist, creating it.", 
ctx.node));
+            LOG.warn("Node '{}' did not exist, creating it.", ctx.node);
             result = createNode(ctx);
         }
         return result;
@@ -264,9 +251,9 @@ public class ZooKeeperProducer extends DefaultProducer {
     private void logStoreComplete(String path, Stat statistics) {
         if (LOG.isDebugEnabled()) {
             if (LOG.isTraceEnabled()) {
-                LOG.trace(format("Stored data to node '%s', and receive 
statistics %s", path, statistics));
+                LOG.trace("Stored data to node '{}', and receive statistics 
%s", path, statistics);
             } else {
-                LOG.debug(format("Stored data to node '%s'", path));
+                LOG.debug("Stored data to node '{}'", path);
             }
         }
     }
diff --git 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cloud/ZooKeeperServiceRegistry.java
 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cloud/ZooKeeperServiceRegistry.java
index cff54bb..946f91d 100644
--- 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cloud/ZooKeeperServiceRegistry.java
+++ 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cloud/ZooKeeperServiceRegistry.java
@@ -263,9 +263,11 @@ public class ZooKeeperServiceRegistry extends 
AbstractServiceRegistry {
             ObjectHelper.notNull(getCamelContext(), "Camel Context");
             ObjectHelper.notNull(configuration.getBasePath(), "ZooKeeper base 
path");
 
-            LOGGER.debug("Starting ZooKeeper Curator with namespace '{}', 
nodes: '{}'",
-                    configuration.getNamespace(),
-                    String.join(",", configuration.getNodes()));
+            if (LOGGER.isDebugEnabled()) {
+                LOGGER.debug("Starting ZooKeeper Curator with namespace '{}', 
nodes: '{}'",
+                        configuration.getNamespace(),
+                        String.join(",", configuration.getNodes()));
+            }
 
             curator = ZooKeeperCuratorHelper.createCurator(configuration);
             curator.start();
diff --git 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterService.java
 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterService.java
index 5e47ffd..3f327dc 100644
--- 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterService.java
+++ 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterService.java
@@ -232,9 +232,11 @@ public class ZooKeeperClusterService extends 
AbstractCamelClusterService<ZooKeep
             if (curator == null) {
                 managedInstance = true;
 
-                LOGGER.debug("Starting ZooKeeper Curator with namespace '{}',  
nodes: '{}'",
-                        configuration.getNamespace(),
-                        String.join(",", configuration.getNodes()));
+                if (LOGGER.isDebugEnabled()) {
+                    LOGGER.debug("Starting ZooKeeper Curator with namespace 
'{}',  nodes: '{}'",
+                            configuration.getNamespace(),
+                            String.join(",", configuration.getNodes()));
+                }
 
                 curator = ZooKeeperCuratorHelper.createCurator(configuration);
                 curator.start();

Reply via email to