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

voonhous pushed a commit to branch release-1.2.1
in repository https://gitbox.apache.org/repos/asf/hudi.git

commit 81fff774a5bdce7c6c4b372d40513552f7a84e7c
Author: voonhous <[email protected]>
AuthorDate: Sun Jul 5 23:49:56 2026 +0800

    refactor(io): use SLF4J parameterized logging instead of string 
concatenation (#19188)
    
    * refactor(io): use SLF4J parameterized logging instead of string 
concatenation
    
    Convert log/LOG string concatenation to {} placeholders in Registry and
    ReflectionUtils. Mechanical and behavior-preserving.
    
    * refactor(io): log context and stack trace in ReflectionUtils error paths
    
    Per review, pass the caught exception as the trailing throwable so SLF4J
    logs the full stack trace, and put the actual in-scope context in the
    placeholder: package name for the getResources IOException, and the
    resource URL for the toURI URISyntaxException.
    
    (cherry picked from commit 2ab2c0a38952a51e5ba9c8813b5e768c36798818)
---
 hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java   | 5 ++---
 .../src/main/java/org/apache/hudi/common/util/ReflectionUtils.java   | 4 ++--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java 
b/hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java
index 7373481c44aa..65f4496597c7 100644
--- a/hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java
+++ b/hudi-io/src/main/java/org/apache/hudi/common/metrics/Registry.java
@@ -98,13 +98,12 @@ public interface Registry extends Serializable {
     Registry registry = REGISTRY_MAP.computeIfAbsent(key, k -> {
       String registryFullName = tableName.isEmpty() ? registryName : tableName 
+ "." + registryName;
       Registry r = (Registry) ReflectionUtils.loadClass(clazz, 
registryFullName);
-      LOG.info("Created a new registry " + r);
+      LOG.info("Created a new registry {}", r);
       return r;
     });
 
     if (!registry.getClass().getName().equals(clazz)) {
-      LOG.error("Registry with name " + registryName + " already exists with a 
different class " + registry.getClass().getName()
-          + " than the requested class " + clazz);
+      LOG.error("Registry with name {} already exists with a different class 
{} than the requested class {}", registryName, registry.getClass().getName(), 
clazz);
     }
     return registry;
   }
diff --git 
a/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java 
b/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
index 49c3e6c9dea3..cb4cbc4290f8 100644
--- a/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
+++ b/hudi-io/src/main/java/org/apache/hudi/common/util/ReflectionUtils.java
@@ -136,7 +136,7 @@ public class ReflectionUtils {
     try {
       resources = classLoader.getResources(path);
     } catch (IOException e) {
-      log.error("Unable to fetch Resources in package " + e.getMessage());
+      log.error("Unable to fetch Resources in package {}", packageName, e);
     }
     List<File> directories = new ArrayList<>();
     while (Objects.requireNonNull(resources).hasMoreElements()) {
@@ -144,7 +144,7 @@ public class ReflectionUtils {
       try {
         directories.add(new File(resource.toURI()));
       } catch (URISyntaxException e) {
-        log.error("Unable to get " + e.getMessage());
+        log.error("Unable to get URI for {}", resource, e);
       }
     }
     List<String> classes = new ArrayList<>();

Reply via email to