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

leesf pushed a commit to branch redo-log
in repository https://gitbox.apache.org/repos/asf/incubator-hudi.git


The following commit(s) were added to refs/heads/redo-log by this push:
     new 9fec7c1  [HUDI-460] Redo hudi-integ-test log statements using SLF4J 
(#1183)
9fec7c1 is described below

commit 9fec7c11ab4e505d10f69cf700a30158a6998517
Author: Mathieu <49835526+wangxian...@users.noreply.github.com>
AuthorDate: Tue Jan 7 14:42:09 2020 +0800

    [HUDI-460] Redo hudi-integ-test log statements using SLF4J (#1183)
---
 hudi-integ-test/pom.xml                              |  5 +++++
 .../test/java/org/apache/hudi/integ/ITTestBase.java  | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/hudi-integ-test/pom.xml b/hudi-integ-test/pom.xml
index af82818..194a1ec 100644
--- a/hudi-integ-test/pom.xml
+++ b/hudi-integ-test/pom.xml
@@ -63,6 +63,11 @@
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j.version}</version>
+    </dependency>
 
     <!-- Hoodie - Import -->
     <dependency>
diff --git 
a/hudi-integ-test/src/test/java/org/apache/hudi/integ/ITTestBase.java 
b/hudi-integ-test/src/test/java/org/apache/hudi/integ/ITTestBase.java
index 5e6f90e..8da506b 100644
--- a/hudi-integ-test/src/test/java/org/apache/hudi/integ/ITTestBase.java
+++ b/hudi-integ-test/src/test/java/org/apache/hudi/integ/ITTestBase.java
@@ -31,10 +31,10 @@ import com.github.dockerjava.core.DockerClientBuilder;
 import com.github.dockerjava.core.DockerClientConfig;
 import com.github.dockerjava.core.command.ExecStartResultCallback;
 import com.github.dockerjava.jaxrs.JerseyDockerCmdExecFactory;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
 import org.junit.Assert;
 import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -49,7 +49,7 @@ import static org.awaitility.Awaitility.await;
 
 public abstract class ITTestBase {
 
-  public static final Logger LOG = LogManager.getLogger(ITTestBase.class);
+  public static final Logger LOG = LoggerFactory.getLogger(ITTestBase.class);
   protected static final String SPARK_WORKER_CONTAINER = "/spark-worker-1";
   protected static final String ADHOC_1_CONTAINER = "/adhoc-1";
   protected static final String ADHOC_2_CONTAINER = "/adhoc-2";
@@ -135,7 +135,7 @@ public abstract class ITTestBase {
     List<Container> containerList = dockerClient.listContainersCmd().exec();
     for (Container c : containerList) {
       if (!c.getState().equalsIgnoreCase("running")) {
-        LOG.info("Container : " + Arrays.toString(c.getNames()) + "not in 
running state,  Curr State :" + c.getState());
+        LOG.info("Container : {} not in running state, Curr State : {}", 
Arrays.toString(c.getNames()), c.getState());
         return false;
       }
     }
@@ -160,9 +160,9 @@ public abstract class ITTestBase {
     
dockerClient.execStartCmd(createCmdResponse.getId()).withDetach(false).withTty(false).exec(callback)
         .awaitCompletion();
     int exitCode = 
dockerClient.inspectExecCmd(createCmdResponse.getId()).exec().getExitCode();
-    LOG.info("Exit code for command : " + exitCode);
-    LOG.error("\n\n ###### Stdout #######\n" + 
callback.getStdout().toString());
-    LOG.error("\n\n ###### Stderr #######\n" + 
callback.getStderr().toString());
+    LOG.info("Exit code for command : {}", exitCode);
+    LOG.error("\n\n ###### Stdout #######\n{}", callback.getStdout());
+    LOG.error("\n\n ###### Stderr #######\n{}", callback.getStderr());
 
     if (expectedToSucceed) {
       Assert.assertEquals("Command (" + Arrays.toString(command) + ") expected 
to succeed. Exit (" + exitCode + ")", 0, exitCode);
@@ -183,7 +183,7 @@ public abstract class ITTestBase {
   TestExecStartResultCallback executeCommandStringInDocker(String 
containerName, String cmd, boolean expectedToSucceed)
       throws Exception {
     
LOG.info("\n\n#################################################################################################");
-    LOG.info("Container : " + containerName + ", Running command :" + cmd);
+    LOG.info("Container : {}, Running command : {}", containerName, cmd);
     
LOG.info("\n#################################################################################################");
 
     String[] cmdSplits = singleSpace(cmd).split(" ");
@@ -193,7 +193,7 @@ public abstract class ITTestBase {
   Pair<String, String> executeHiveCommand(String hiveCommand) throws Exception 
{
 
     
LOG.info("\n\n#################################################################################################");
-    LOG.info("Running hive command :" + hiveCommand);
+    LOG.info("Running hive command : {}", hiveCommand);
     
LOG.info("\n#################################################################################################");
 
     String[] hiveCmd = getHiveConsoleCommand(hiveCommand);
@@ -239,7 +239,7 @@ public abstract class ITTestBase {
           executeCommandStringInDocker(HIVESERVER, "cat /tmp/root/hive.log", 
true).getStdout().toString();
       String filePath = System.getProperty("java.io.tmpdir") + "/" + 
System.currentTimeMillis() + "-hive.log";
       FileIOUtils.writeStringToFile(hiveLogStr, filePath);
-      LOG.info("Hive log saved up at  : " + filePath);
+      LOG.info("Hive log saved up at : {}", filePath);
     } catch (Exception e) {
       LOG.error("Unable to save up logs..", e);
     }

Reply via email to