You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2021/06/01 02:13:49 UTC

[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5338]. Add logging prefix in interpreter.sh for easy diagnose

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

zjffdu pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/branch-0.9 by this push:
     new 9bbf039  [ZEPPELIN-5338]. Add logging prefix in interpreter.sh for easy diagnose
9bbf039 is described below

commit 9bbf039c41a2837a8e2557537e7155b9c7ad33cf
Author: Jeff Zhang <zj...@apache.org>
AuthorDate: Sat May 15 12:43:06 2021 +0800

    [ZEPPELIN-5338]. Add logging prefix in interpreter.sh for easy diagnose
    
    ### What is this PR for?
    
    Currently, we have to change log4j.properties to get more output from script `interpreter.sh` in log4j output for diagnose. This PR is to add one trick: as long as the output is start with `[INFO]` in `interpreter.sh`, it will be redirected to log4j output.
    
    ### What type of PR is it?
    [ Improvement ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-5338
    
    ### How should this be tested?
    * CI pass
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zj...@apache.org>
    
    Closes #4104 from zjffdu/ZEPPELIN-5338 and squashes the following commits:
    
    32bde84f3f [Jeff Zhang] Fix comment
    1aff5343c0 [Jeff Zhang] [ZEPPELIN-5338]. Add logging prefix in interpreter.sh for easy diagnose
    
    (cherry picked from commit f3c1c2aa15005b2c8db97f3daaa3916e576e2aff)
    Signed-off-by: Jeff Zhang <zj...@apache.org>
---
 bin/interpreter.sh                                                    | 4 +++-
 .../java/org/apache/zeppelin/interpreter/util/ProcessLauncher.java    | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/interpreter.sh b/bin/interpreter.sh
index 527fa6b..d0aad29 100755
--- a/bin/interpreter.sh
+++ b/bin/interpreter.sh
@@ -310,5 +310,7 @@ else
 fi
 
 # Don't remove this echo, it is for diagnose, this line of output will be redirected to java log4j output.
-echo "Interpreter launch command: ${INTERPRETER_RUN_COMMAND[@]}"
+# Output that starts with `[INFO]` will be redirected to log4j INFO output. Other outputs from interpreter.sh
+# will be redirected to log4j DEBUG output.
+echo "[INFO] Interpreter launch command: ${INTERPRETER_RUN_COMMAND[@]}"
 exec "${INTERPRETER_RUN_COMMAND[@]}"
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/util/ProcessLauncher.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/util/ProcessLauncher.java
index eb0b65b..5c792cf 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/util/ProcessLauncher.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/util/ProcessLauncher.java
@@ -185,7 +185,7 @@ public abstract class ProcessLauncher implements ExecuteResultHandler {
     @Override
     protected void processLine(String s, int i) {
       // print Interpreter launch command for diagnose purpose
-      if (s.startsWith("Interpreter launch command")) {
+      if (s.startsWith("[INFO]")) {
         LOGGER.info(s);
       } else {
         LOGGER.debug("Process Output: {}", s);