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 71c368d3a4720d4e2ebc6bc5cee1a9cd2700e1c1
Author: voonhous <[email protected]>
AuthorDate: Sat Jul 4 19:02:49 2026 +0800

    refactor(cli): use SLF4J parameterized logging instead of string 
concatenation (#19159)
    
    * refactor(cli): use SLF4J parameterized logging instead of string 
concatenation
    
    Convert log string concatenation to {} placeholders across hudi-cli.
    Mechanical and behavior-preserving. Notable handling:
    - MetadataCommand: two long multi-line concatenations (FS/metadata file size
      mismatch) rewritten as wrapped parameterized calls; the inline equality
      expression becomes a boolean {} arg.
    - RepairsCommand: drop redundant hoodieInstant.toString() in the 
parameterized arg.
    - TableCommand: kept schema.toString(true) as-is (formatted print, not a
      redundant no-arg toString).
    
    * refactor(cli): serialize table schema once in fetchTableSchema
    
    Extract schema.toString(true) to a local in the outputFilePath branch so it
    is computed once and reused for both the log statement and writeToFile,
    instead of serializing the schema twice. Per review.
    
    (cherry picked from commit d585f83462d7f6f220df733dd66a7942173e7c55)
---
 .../hudi/cli/commands/CompactionCommand.java       |  2 +-
 .../apache/hudi/cli/commands/ExportCommand.java    |  2 +-
 .../hudi/cli/commands/LockAuditingCommand.java     |  6 ++---
 .../apache/hudi/cli/commands/MetadataCommand.java  | 31 +++++++++++-----------
 .../apache/hudi/cli/commands/RepairsCommand.java   |  6 ++---
 .../org/apache/hudi/cli/commands/TableCommand.java |  5 ++--
 6 files changed, 26 insertions(+), 26 deletions(-)

diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java
index 61a8ba5c6b12..53c48c847570 100644
--- a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java
+++ b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/CompactionCommand.java
@@ -432,7 +432,7 @@ public class CompactionCommand {
     ObjectInputStream in = new ObjectInputStream(inputStream);
     try {
       T result = (T) in.readObject();
-      log.info("Result : " + result);
+      log.info("Result : {}", result);
       return result;
     } finally {
       in.close();
diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/ExportCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/ExportCommand.java
index 8692efb8f6ba..83bdbbdb9c5c 100644
--- a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/ExportCommand.java
+++ b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/ExportCommand.java
@@ -172,7 +172,7 @@ public class ExportCommand {
 
               final String instantTime = 
archiveEntryRecord.get("commitTime").toString();
               if (metadata == null) {
-                log.error("Could not load metadata for action " + action + " 
at instant time " + instantTime);
+                log.error("Could not load metadata for action {} at instant 
time {}", action, instantTime);
                 continue;
               }
               final String outPath = localFolder + StoragePath.SEPARATOR + 
instantTime + "." + action;
diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/LockAuditingCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/LockAuditingCommand.java
index 8aa709646d3f..3550916373e4 100644
--- 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/LockAuditingCommand.java
+++ 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/LockAuditingCommand.java
@@ -503,7 +503,7 @@ public class LockAuditingCommand {
             deletedCount++;
           } catch (Exception e) {
             failedCount++;
-            log.warn("Failed to delete audit file: " + pathInfo.getPath(), e);
+            log.warn("Failed to delete audit file: {}", pathInfo.getPath(), e);
           }
         }
         
@@ -543,7 +543,7 @@ public class LockAuditingCommand {
             AuditRecord entry = OBJECT_MAPPER.readValue(line, 
AuditRecord.class);
             entries.add(entry);
           } catch (Exception e) {
-            log.warn("Failed to parse JSON line in file " + filename + ": " + 
line, e);
+            log.warn("Failed to parse JSON line in file {}: {}", filename, 
line, e);
           }
         }
       }
@@ -592,7 +592,7 @@ public class LockAuditingCommand {
           filename
       ));
     } catch (Exception e) {
-      log.warn("Failed to parse audit file: " + filename, e);
+      log.warn("Failed to parse audit file: {}", filename, e);
       return Option.empty();
     }
   }
diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/MetadataCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/MetadataCommand.java
index dbdc32211a96..e2e86193b2ee 100644
--- a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/MetadataCommand.java
+++ b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/MetadataCommand.java
@@ -307,8 +307,8 @@ public class MetadataCommand {
 
     if (!fsPartitions.equals(metadataPartitions)) {
       log.error("FS partition listing is not matching with metadata partition 
listing!");
-      log.error("All FS partitions: " + 
Arrays.toString(fsPartitions.toArray()));
-      log.error("All Metadata partitions: " + 
Arrays.toString(metadataPartitions.toArray()));
+      log.error("All FS partitions: {}", 
Arrays.toString(fsPartitions.toArray()));
+      log.error("All Metadata partitions: {}", 
Arrays.toString(metadataPartitions.toArray()));
     }
 
     final List<Comparable[]> rows = new ArrayList<>();
@@ -351,34 +351,33 @@ public class MetadataCommand {
       }
 
       if (metadataPathInfoList.size() != pathInfoList.size()) {
-        log.error(" FS and metadata files count not matching for " + partition
-            + ". FS files count " + pathInfoList.size()
-            + ", metadata base files count " + metadataPathInfoList.size());
+        log.error(" FS and metadata files count not matching for {}. FS files 
count {}, metadata base files count {}", partition, pathInfoList.size(), 
metadataPathInfoList.size());
       }
 
       for (Map.Entry<String, StoragePathInfo> entry : pathInfoMap.entrySet()) {
         if (!metadataPathInfoMap.containsKey(entry.getKey())) {
-          log.error("FS file not found in metadata " + entry.getKey());
+          log.error("FS file not found in metadata {}", entry.getKey());
         } else {
           if (entry.getValue().getLength()
               != metadataPathInfoMap.get(entry.getKey()).getLength()) {
-            log.error(" FS file size mismatch " + entry.getKey() + ", size 
equality "
-                + (entry.getValue().getLength()
-                == metadataPathInfoMap.get(entry.getKey()).getLength())
-                + ". FS size " + entry.getValue().getLength()
-                + ", metadata size " + 
metadataPathInfoMap.get(entry.getKey()).getLength());
+            log.error(" FS file size mismatch {}, size equality {}. FS size 
{}, metadata size {}",
+                entry.getKey(),
+                entry.getValue().getLength() == 
metadataPathInfoMap.get(entry.getKey()).getLength(),
+                entry.getValue().getLength(),
+                metadataPathInfoMap.get(entry.getKey()).getLength());
           }
         }
       }
       for (Map.Entry<String, StoragePathInfo> entry : 
metadataPathInfoMap.entrySet()) {
         if (!pathInfoMap.containsKey(entry.getKey())) {
-          log.error("Metadata file not found in FS " + entry.getKey());
+          log.error("Metadata file not found in FS {}", entry.getKey());
         } else {
           if (entry.getValue().getLength() != 
pathInfoMap.get(entry.getKey()).getLength()) {
-            log.error(" Metadata file size mismatch " + entry.getKey() + ", 
size equality "
-                + (entry.getValue().getLength() == 
pathInfoMap.get(entry.getKey()).getLength())
-                + ". Metadata size " + entry.getValue().getLength() + ", FS 
size "
-                + metadataPathInfoMap.get(entry.getKey()).getLength());
+            log.error(" Metadata file size mismatch {}, size equality {}. 
Metadata size {}, FS size {}",
+                entry.getKey(),
+                entry.getValue().getLength() == 
pathInfoMap.get(entry.getKey()).getLength(),
+                entry.getValue().getLength(),
+                metadataPathInfoMap.get(entry.getKey()).getLength());
           }
         }
       }
diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/RepairsCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/RepairsCommand.java
index 6003e936b819..872ff342dce5 100644
--- a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/RepairsCommand.java
+++ b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/RepairsCommand.java
@@ -197,12 +197,12 @@ public class RepairsCommand {
       try {
         CleanerUtils.getCleanerPlan(client, instant);
       } catch (AvroRuntimeException e) {
-        log.warn("Corruption found. Trying to remove corrupted clean instant 
file: " + instant);
+        log.warn("Corruption found. Trying to remove corrupted clean instant 
file: {}", instant);
         TimelineUtils.deleteInstantFile(client.getStorage(), 
client.getTimelinePath(),
             instant, client.getInstantFileNameGenerator());
       } catch (IOException ioe) {
         if (ioe.getMessage().contains("Not an Avro data file")) {
-          log.warn("Corruption found. Trying to remove corrupted clean instant 
file: " + instant);
+          log.warn("Corruption found. Trying to remove corrupted clean instant 
file: {}", instant);
           TimelineUtils.deleteInstantFile(client.getStorage(), 
client.getTimelinePath(),
               instant, client.getInstantFileNameGenerator());
         } else {
@@ -216,7 +216,7 @@ public class RepairsCommand {
   public void showFailedCommits() {
     HoodieTableMetaClient metaClient = HoodieCLI.getTableMetaClient();
     HoodieActiveTimeline activeTimeline =  metaClient.getActiveTimeline();
-    
activeTimeline.filterCompletedInstants().getInstantsAsStream().filter(activeTimeline::isEmpty).forEach(hoodieInstant
 -> log.warn("Empty Commit: " + hoodieInstant.toString()));
+    
activeTimeline.filterCompletedInstants().getInstantsAsStream().filter(activeTimeline::isEmpty).forEach(hoodieInstant
 -> log.warn("Empty Commit: {}", hoodieInstant));
   }
 
   @ShellMethod(key = "repair migrate-partition-meta", value = "Migrate all 
partition meta file currently stored in text format "
diff --git 
a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/TableCommand.java 
b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/TableCommand.java
index 0e3f7a4029dc..ed4b75b3924a 100644
--- a/hudi-cli/src/main/java/org/apache/hudi/cli/commands/TableCommand.java
+++ b/hudi-cli/src/main/java/org/apache/hudi/cli/commands/TableCommand.java
@@ -206,8 +206,9 @@ public class TableCommand {
     TableSchemaResolver tableSchemaResolver = new TableSchemaResolver(client);
     HoodieSchema schema = tableSchemaResolver.getTableSchema();
     if (outputFilePath != null) {
-      log.info("Latest table schema : " + schema.toString(true));
-      writeToFile(outputFilePath, schema.toString(true));
+      String schemaStr = schema.toString(true);
+      log.info("Latest table schema : {}", schemaStr);
+      writeToFile(outputFilePath, schemaStr);
       return String.format("Latest table schema written to %s", 
outputFilePath);
     } else {
       return String.format("Latest table schema %s", schema.toString(true));

Reply via email to