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


The following commit(s) were added to refs/heads/main by this push:
     new c0b4a2b3b8d (chores) do log exception messages (#11472)
c0b4a2b3b8d is described below

commit c0b4a2b3b8dfe23df20c5c42e08143cd125687fb
Author: Otavio Rodolfo Piske <orpi...@users.noreply.github.com>
AuthorDate: Tue Sep 19 19:11:55 2023 +0200

    (chores) do log exception messages (#11472)
    
    Logging the exception message should provide better information when 
debugging or reading logs
---
 .../org/apache/camel/component/consul/cluster/ConsulClusterView.java  | 2 +-
 .../component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java | 2 +-
 .../camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java  | 2 +-
 .../org/apache/camel/component/consul/cluster/ConsulMasterIT.java     | 2 +-
 .../src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java   | 3 +--
 .../embedded/cluster/AbstractInfinispanEmbeddedClusteredTest.java     | 2 +-
 .../apache/camel/component/jgroups/cluster/JGroupsLockMasterTest.java | 2 +-
 .../java/org/apache/camel/component/master/MasterComponentTest.java   | 2 +-
 .../apache/camel/component/netty/UnsharableCodecsConflicts2Test.java  | 2 +-
 .../apache/camel/component/netty/UnsharableCodecsConflictsTest.java   | 2 +-
 .../component/zookeepermaster/group/internal/ZooKeeperGroup.java      | 4 ++--
 .../camel/component/zookeeper/cloud/ZooKeeperServiceRegistry.java     | 4 ++--
 .../camel/component/zookeeper/cluster/ZooKeeperClusterView.java       | 2 +-
 .../cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java   | 2 +-
 .../cluster/integration/ZooKeeperClusteredRoutePolicyIT.java          | 2 +-
 .../component/zookeeper/cluster/integration/ZooKeeperMasterIT.java    | 2 +-
 .../file/cluster/FileLockClusteredRoutePolicyFactoryTest.java         | 2 +-
 .../component/file/cluster/FileLockClusteredRoutePolicyTest.java      | 2 +-
 18 files changed, 20 insertions(+), 21 deletions(-)

diff --git 
a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cluster/ConsulClusterView.java
 
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cluster/ConsulClusterView.java
index aa43fa0c361..39ebed2c334 100644
--- 
a/components/camel-consul/src/main/java/org/apache/camel/component/consul/cluster/ConsulClusterView.java
+++ 
b/components/camel-consul/src/main/java/org/apache/camel/component/consul/cluster/ConsulClusterView.java
@@ -261,7 +261,7 @@ final class ConsulClusterView extends 
AbstractCamelClusterView {
 
         @Override
         public void onFailure(Throwable throwable) {
-            LOGGER.debug("", throwable);
+            LOGGER.debug("{}", throwable.getMessage(), throwable);
 
             if (sessionId.get() != null) {
                 keyValueClient.releaseLock(configuration.getRootPath(), 
sessionId.get());
diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java
index 1f4a01c1664..839fc73a1a8 100644
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java
+++ 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyFactoryIT.java
@@ -109,7 +109,7 @@ public class ConsulClusteredRoutePolicyFactoryIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java
index 6d68c736702..2b5a32581e6 100644
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java
+++ 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulClusteredRoutePolicyIT.java
@@ -107,7 +107,7 @@ public class ConsulClusteredRoutePolicyIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java
 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java
index 1b6e16bfe56..f28c99a67de 100644
--- 
a/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java
+++ 
b/components/camel-consul/src/test/java/org/apache/camel/component/consul/cluster/ConsulMasterIT.java
@@ -105,7 +105,7 @@ public class ConsulMasterIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java
 
b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java
index 843907561c0..9c3000c02d8 100644
--- 
a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java
+++ 
b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/HdfsProducer.java
@@ -119,8 +119,7 @@ public class HdfsProducer extends DefaultProducer {
                         config.getCheckIdleInterval(), TimeUnit.MILLISECONDS);
             }
         } catch (Exception e) {
-            LOG.warn("Failed to start the HDFS producer. Caused by: [{}]", 
e.getMessage());
-            LOG.debug("", e);
+            LOG.warn("Failed to start the HDFS producer. Caused by: [{}]", 
e.getMessage(), e);
             throw new RuntimeCamelException(e);
         } finally {
             HdfsComponent.setJAASConfiguration(auth);
diff --git 
a/components/camel-infinispan/camel-infinispan-embedded/src/test/java/org/apache/camel/component/infinispan/embedded/cluster/AbstractInfinispanEmbeddedClusteredTest.java
 
b/components/camel-infinispan/camel-infinispan-embedded/src/test/java/org/apache/camel/component/infinispan/embedded/cluster/AbstractInfinispanEmbeddedClusteredTest.java
index 4b1aaff67fc..27992edc9d5 100644
--- 
a/components/camel-infinispan/camel-infinispan-embedded/src/test/java/org/apache/camel/component/infinispan/embedded/cluster/AbstractInfinispanEmbeddedClusteredTest.java
+++ 
b/components/camel-infinispan/camel-infinispan-embedded/src/test/java/org/apache/camel/component/infinispan/embedded/cluster/AbstractInfinispanEmbeddedClusteredTest.java
@@ -54,7 +54,7 @@ abstract class AbstractInfinispanEmbeddedClusteredTest {
                         logger.debug("Node {} is shutting down", id);
                         results.add(id);
                     } catch (Exception e) {
-                        logger.warn("", e);
+                        logger.warn("{}", e.getMessage(), e);
                     } finally {
                         latch.countDown();
                     }
diff --git 
a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/cluster/JGroupsLockMasterTest.java
 
b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/cluster/JGroupsLockMasterTest.java
index 61aebd0286a..2753a5a06cb 100644
--- 
a/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/cluster/JGroupsLockMasterTest.java
+++ 
b/components/camel-jgroups/src/test/java/org/apache/camel/component/jgroups/cluster/JGroupsLockMasterTest.java
@@ -98,7 +98,7 @@ public class JGroupsLockMasterTest {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-master/src/test/java/org/apache/camel/component/master/MasterComponentTest.java
 
b/components/camel-master/src/test/java/org/apache/camel/component/master/MasterComponentTest.java
index 0aa4e7b21a0..4d1294261ff 100644
--- 
a/components/camel-master/src/test/java/org/apache/camel/component/master/MasterComponentTest.java
+++ 
b/components/camel-master/src/test/java/org/apache/camel/component/master/MasterComponentTest.java
@@ -99,7 +99,7 @@ public class MasterComponentTest {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflicts2Test.java
 
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflicts2Test.java
index e0e49fca22a..02e628159b8 100644
--- 
a/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflicts2Test.java
+++ 
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflicts2Test.java
@@ -67,7 +67,7 @@ public class UnsharableCodecsConflicts2Test extends 
BaseNettyTest {
             sendBuffer(body1, client1);
             sendBuffer(new String("9").getBytes(), client2);
         } catch (Exception e) {
-            LOG.error("", e);
+            LOG.error("{}", e.getMessage(), e);
         } finally {
             client1.close();
             client2.close();
diff --git 
a/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflictsTest.java
 
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflictsTest.java
index 49ebf60ecf7..92eb2a10d83 100644
--- 
a/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflictsTest.java
+++ 
b/components/camel-netty/src/test/java/org/apache/camel/component/netty/UnsharableCodecsConflictsTest.java
@@ -73,7 +73,7 @@ public class UnsharableCodecsConflictsTest extends 
BaseNettyTest {
             sendSopBuffer(bodyPort1, server1);
             sendSopBuffer(new String("9").getBytes(), server2);
         } catch (Exception e) {
-            LOG.error("", e);
+            LOG.error("{}", e.getMessage(), e);
         } finally {
             server1.close();
             server2.close();
diff --git 
a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
index 42f57146837..cce971c489e 100644
--- 
a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
+++ 
b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/ZooKeeperGroup.java
@@ -482,9 +482,9 @@ public class ZooKeeperGroup<T extends NodeState> implements 
Group<T> {
      */
     protected void handleException(Throwable e) {
         if (e instanceof IllegalStateException && "Client is not 
started".equals(e.getMessage())) {
-            LOG.debug("", e);
+            LOG.debug("{}", e.getMessage(), e);
         } else {
-            LOG.error("", e);
+            LOG.error("{}", e.getMessage(), e);
         }
     }
 
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 ac32f546431..1a578095dfc 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
@@ -337,7 +337,7 @@ public class ZooKeeperServiceRegistry extends 
AbstractServiceRegistry {
             // add the serviceId to the list of known server
             serviceList.add(definition.getId());
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 
@@ -360,7 +360,7 @@ public class ZooKeeperServiceRegistry extends 
AbstractServiceRegistry {
                 }
             }
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 
diff --git 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterView.java
 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterView.java
index e99eff78944..e7a4b794e2a 100644
--- 
a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterView.java
+++ 
b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/cluster/ZooKeeperClusterView.java
@@ -195,7 +195,7 @@ final class ZooKeeperClusterView extends 
AbstractCamelClusterView {
             try {
                 return leaderSelector.getLeader().equals(this.participant);
             } catch (Exception e) {
-                LOGGER.debug("", e);
+                LOGGER.debug("{}", e.getMessage(), e);
                 return false;
             }
         }
diff --git 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java
 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java
index 2cdb76ecfa1..76846bcf9cf 100644
--- 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java
+++ 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyFactoryIT.java
@@ -110,7 +110,7 @@ public final class ZooKeeperClusteredRoutePolicyFactoryIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java
 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java
index 3ea4dd6395f..e5f4dc725ce 100644
--- 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java
+++ 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperClusteredRoutePolicyIT.java
@@ -110,7 +110,7 @@ public final class ZooKeeperClusteredRoutePolicyIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java
 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java
index d1e23eafffe..e8fdb284b0b 100644
--- 
a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java
+++ 
b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/cluster/integration/ZooKeeperMasterIT.java
@@ -108,7 +108,7 @@ public final class ZooKeeperMasterIT {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyFactoryTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyFactoryTest.java
index 4779b50cc2d..3d9a2ae905e 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyFactoryTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyFactoryTest.java
@@ -101,7 +101,7 @@ public final class FileLockClusteredRoutePolicyFactoryTest {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyTest.java
index ebfd3219575..17c4f4d9e0a 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/component/file/cluster/FileLockClusteredRoutePolicyTest.java
@@ -101,7 +101,7 @@ public final class FileLockClusteredRoutePolicyTest {
 
             LATCH.countDown();
         } catch (Exception e) {
-            LOGGER.warn("", e);
+            LOGGER.warn("{}", e.getMessage(), e);
         }
     }
 }

Reply via email to