YARN-6126. Obtaining app logs for Running application fails with json parse error. Contributed by Xuan Gong.
This commit is contained in:
parent
165f07f51a
commit
1a16431bd0
@ -426,8 +426,17 @@ private List<PerContainerLogFileInfo> getContainerLogFiles(
|
|||||||
if (response.getStatusInfo().getStatusCode() ==
|
if (response.getStatusInfo().getStatusCode() ==
|
||||||
ClientResponse.Status.OK.getStatusCode()) {
|
ClientResponse.Status.OK.getStatusCode()) {
|
||||||
try {
|
try {
|
||||||
|
JSONArray array = new JSONArray();
|
||||||
JSONObject json = response.getEntity(JSONObject.class);
|
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++) {
|
for (int i = 0; i < array.length(); i++) {
|
||||||
JSONObject log = array.getJSONObject(i);
|
JSONObject log = array.getJSONObject(i);
|
||||||
Object ob = log.get("containerLogInfo");
|
Object ob = log.get("containerLogInfo");
|
||||||
|
Loading…
Reference in New Issue
Block a user