hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed by Xuan Gong.
Date Fri, 27 Jan 2017 14:31:10 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 165f07f51 -> 1a16431bd


YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed
by Xuan Gong.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/1a16431b
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/1a16431b
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/1a16431b

Branch: refs/heads/trunk
Commit: 1a16431bd0df52d2df32c594f8b9b506c2101ad8
Parents: 165f07f
Author: Junping Du <junping_du@apache.org>
Authored: Fri Jan 27 06:31:10 2017 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Fri Jan 27 06:31:10 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/hadoop/yarn/client/cli/LogsCLI.java  | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/1a16431b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
index b8119e5..1de4cd1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java
@@ -426,8 +426,17 @@ public class LogsCLI extends Configured implements Tool {
       if (response.getStatusInfo().getStatusCode() ==
           ClientResponse.Status.OK.getStatusCode()) {
         try {
+          JSONArray array = new JSONArray();
           JSONObject json = response.getEntity(JSONObject.class);
-          JSONArray array = json.getJSONArray("containerLogsInfo");
+          Object logsInfoObj = json.get("containerLogsInfo");
+          if (logsInfoObj instanceof JSONObject) {
+            array.put((JSONObject)logsInfoObj);
+          } else if (logsInfoObj instanceof JSONArray) {
+            JSONArray logsArray = (JSONArray)logsInfoObj;
+            for (int i=0; i < logsArray.length(); i++) {
+              array.put(logsArray.getJSONObject(i));
+            }
+          }
           for (int i = 0; i < array.length(); i++) {
             JSONObject log = array.getJSONObject(i);
             Object ob = log.get("containerLogInfo");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message