[10/50] hadoop git commit: YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose logs are aggregated via a "show_container_log_info" option. Contributed by Xuan Gong.

2016-07-19 Thread subru
YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose 
logs are aggregated via a "show_container_log_info" option. 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/eb471632
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/eb471632
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/eb471632

Branch: refs/heads/YARN-2915
Commit: eb471632349deac4b62f8dec853c8ceb64c9617a
Parents: 5614217
Author: Vinod Kumar Vavilapalli 
Authored: Wed Jul 13 10:47:43 2016 -0700
Committer: Vinod Kumar Vavilapalli 
Committed: Wed Jul 13 10:54:15 2016 -0700

--
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 321 ++-
 .../hadoop/yarn/client/cli/TestLogsCLI.java |  85 +++--
 .../logaggregation/AggregatedLogFormat.java |  13 +-
 .../yarn/logaggregation/LogCLIHelpers.java  |  97 +-
 4 files changed, 392 insertions(+), 124 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/eb471632/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 79401b1..31395be 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
@@ -78,14 +78,30 @@ public class LogsCLI extends Configured implements Tool {
   private static final String APP_OWNER_OPTION = "appOwner";
   private static final String AM_CONTAINER_OPTION = "am";
   private static final String CONTAINER_LOG_FILES = "logFiles";
-  private static final String SHOW_META_INFO = "show_meta_info";
   private static final String LIST_NODES_OPTION = "list_nodes";
+  private static final String SHOW_APPLICATION_LOG_INFO
+  = "show_application_log_info";
+  private static final String SHOW_CONTAINER_LOG_INFO
+  = "show_container_log_info";
   private static final String OUT_OPTION = "out";
   private static final String SIZE_OPTION = "size";
   public static final String HELP_CMD = "help";
+  private PrintStream outStream = System.out;
+  private YarnClient yarnClient = null;
 
   @Override
   public int run(String[] args) throws Exception {
+try {
+  yarnClient = createYarnClient();
+  return runCommand(args);
+} finally {
+  if (yarnClient != null) {
+yarnClient.close();
+  }
+}
+  }
+
+  private int runCommand(String[] args) throws Exception {
 Options opts = createCommandOpts();
 Options printOpts = createPrintOpts(opts);
 if (args.length < 1) {
@@ -102,8 +118,9 @@ public class LogsCLI extends Configured implements Tool {
 String nodeAddress = null;
 String appOwner = null;
 boolean getAMContainerLogs = false;
-boolean showMetaInfo = false;
 boolean nodesList = false;
+boolean showApplicationLogInfo = false;
+boolean showContainerLogInfo = false;
 String[] logFiles = null;
 List amContainersList = new ArrayList();
 String localDir = null;
@@ -115,9 +132,11 @@ public class LogsCLI extends Configured implements Tool {
   nodeAddress = commandLine.getOptionValue(NODE_ADDRESS_OPTION);
   appOwner = commandLine.getOptionValue(APP_OWNER_OPTION);
   getAMContainerLogs = commandLine.hasOption(AM_CONTAINER_OPTION);
-  showMetaInfo = commandLine.hasOption(SHOW_META_INFO);
   nodesList = commandLine.hasOption(LIST_NODES_OPTION);
   localDir = commandLine.getOptionValue(OUT_OPTION);
+  showApplicationLogInfo = commandLine.hasOption(
+  SHOW_APPLICATION_LOG_INFO);
+  showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
   if (getAMContainerLogs) {
 try {
   amContainersList = parseAMContainer(commandLine, printOpts);
@@ -172,6 +191,12 @@ public class LogsCLI extends Configured implements Tool {
   }
 }
 
+if (showApplicationLogInfo && showContainerLogInfo) {
+  System.err.println("Invalid options. Can only accept one of "
+  + "show_application_log_info/show_container_log_info.");
+  return -1;
+}
+
 LogCLIHelpers logCliHelper = new LogCLIHelpers();
 logCliHelper.setConf(getConf());
 
@@ -215,14 +240,17 @@ public class LogsCLI extends Configured implements Tool {
 isApplicationFinished(appState), appOwner, nodeAddress, null,
 containerIdStr, localDir, logs, bytes);
 
-if 

[16/50] hadoop git commit: YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose logs are aggregated via a "show_container_log_info" option. Contributed by Xuan Gong.

2016-07-19 Thread subru
YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose 
logs are aggregated via a "show_container_log_info" option. 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/b06353ec
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/b06353ec
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/b06353ec

Branch: refs/heads/YARN-2915
Commit: b06353ec3d19e0d14581ad17b8e3b691d107d63f
Parents: ee086e7
Author: Vinod Kumar Vavilapalli 
Authored: Wed Jul 13 10:47:43 2016 -0700
Committer: Subru Krishnan 
Committed: Tue Jul 19 14:39:30 2016 -0700

--
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 321 ++-
 .../hadoop/yarn/client/cli/TestLogsCLI.java |  85 +++--
 .../logaggregation/AggregatedLogFormat.java |  13 +-
 .../yarn/logaggregation/LogCLIHelpers.java  |  97 +-
 4 files changed, 392 insertions(+), 124 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/b06353ec/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 79401b1..31395be 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
@@ -78,14 +78,30 @@ public class LogsCLI extends Configured implements Tool {
   private static final String APP_OWNER_OPTION = "appOwner";
   private static final String AM_CONTAINER_OPTION = "am";
   private static final String CONTAINER_LOG_FILES = "logFiles";
-  private static final String SHOW_META_INFO = "show_meta_info";
   private static final String LIST_NODES_OPTION = "list_nodes";
+  private static final String SHOW_APPLICATION_LOG_INFO
+  = "show_application_log_info";
+  private static final String SHOW_CONTAINER_LOG_INFO
+  = "show_container_log_info";
   private static final String OUT_OPTION = "out";
   private static final String SIZE_OPTION = "size";
   public static final String HELP_CMD = "help";
+  private PrintStream outStream = System.out;
+  private YarnClient yarnClient = null;
 
   @Override
   public int run(String[] args) throws Exception {
+try {
+  yarnClient = createYarnClient();
+  return runCommand(args);
+} finally {
+  if (yarnClient != null) {
+yarnClient.close();
+  }
+}
+  }
+
+  private int runCommand(String[] args) throws Exception {
 Options opts = createCommandOpts();
 Options printOpts = createPrintOpts(opts);
 if (args.length < 1) {
@@ -102,8 +118,9 @@ public class LogsCLI extends Configured implements Tool {
 String nodeAddress = null;
 String appOwner = null;
 boolean getAMContainerLogs = false;
-boolean showMetaInfo = false;
 boolean nodesList = false;
+boolean showApplicationLogInfo = false;
+boolean showContainerLogInfo = false;
 String[] logFiles = null;
 List amContainersList = new ArrayList();
 String localDir = null;
@@ -115,9 +132,11 @@ public class LogsCLI extends Configured implements Tool {
   nodeAddress = commandLine.getOptionValue(NODE_ADDRESS_OPTION);
   appOwner = commandLine.getOptionValue(APP_OWNER_OPTION);
   getAMContainerLogs = commandLine.hasOption(AM_CONTAINER_OPTION);
-  showMetaInfo = commandLine.hasOption(SHOW_META_INFO);
   nodesList = commandLine.hasOption(LIST_NODES_OPTION);
   localDir = commandLine.getOptionValue(OUT_OPTION);
+  showApplicationLogInfo = commandLine.hasOption(
+  SHOW_APPLICATION_LOG_INFO);
+  showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
   if (getAMContainerLogs) {
 try {
   amContainersList = parseAMContainer(commandLine, printOpts);
@@ -172,6 +191,12 @@ public class LogsCLI extends Configured implements Tool {
   }
 }
 
+if (showApplicationLogInfo && showContainerLogInfo) {
+  System.err.println("Invalid options. Can only accept one of "
+  + "show_application_log_info/show_container_log_info.");
+  return -1;
+}
+
 LogCLIHelpers logCliHelper = new LogCLIHelpers();
 logCliHelper.setConf(getConf());
 
@@ -215,14 +240,17 @@ public class LogsCLI extends Configured implements Tool {
 isApplicationFinished(appState), appOwner, nodeAddress, null,
 containerIdStr, localDir, logs, bytes);
 
-if 

[19/50] hadoop git commit: YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose logs are aggregated via a "show_container_log_info" option. Contributed by Xuan Gong.

2016-07-15 Thread sjlee
YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose 
logs are aggregated via a "show_container_log_info" option. 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/eb471632
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/eb471632
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/eb471632

Branch: refs/heads/YARN-5355
Commit: eb471632349deac4b62f8dec853c8ceb64c9617a
Parents: 5614217
Author: Vinod Kumar Vavilapalli 
Authored: Wed Jul 13 10:47:43 2016 -0700
Committer: Vinod Kumar Vavilapalli 
Committed: Wed Jul 13 10:54:15 2016 -0700

--
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 321 ++-
 .../hadoop/yarn/client/cli/TestLogsCLI.java |  85 +++--
 .../logaggregation/AggregatedLogFormat.java |  13 +-
 .../yarn/logaggregation/LogCLIHelpers.java  |  97 +-
 4 files changed, 392 insertions(+), 124 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/eb471632/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 79401b1..31395be 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
@@ -78,14 +78,30 @@ public class LogsCLI extends Configured implements Tool {
   private static final String APP_OWNER_OPTION = "appOwner";
   private static final String AM_CONTAINER_OPTION = "am";
   private static final String CONTAINER_LOG_FILES = "logFiles";
-  private static final String SHOW_META_INFO = "show_meta_info";
   private static final String LIST_NODES_OPTION = "list_nodes";
+  private static final String SHOW_APPLICATION_LOG_INFO
+  = "show_application_log_info";
+  private static final String SHOW_CONTAINER_LOG_INFO
+  = "show_container_log_info";
   private static final String OUT_OPTION = "out";
   private static final String SIZE_OPTION = "size";
   public static final String HELP_CMD = "help";
+  private PrintStream outStream = System.out;
+  private YarnClient yarnClient = null;
 
   @Override
   public int run(String[] args) throws Exception {
+try {
+  yarnClient = createYarnClient();
+  return runCommand(args);
+} finally {
+  if (yarnClient != null) {
+yarnClient.close();
+  }
+}
+  }
+
+  private int runCommand(String[] args) throws Exception {
 Options opts = createCommandOpts();
 Options printOpts = createPrintOpts(opts);
 if (args.length < 1) {
@@ -102,8 +118,9 @@ public class LogsCLI extends Configured implements Tool {
 String nodeAddress = null;
 String appOwner = null;
 boolean getAMContainerLogs = false;
-boolean showMetaInfo = false;
 boolean nodesList = false;
+boolean showApplicationLogInfo = false;
+boolean showContainerLogInfo = false;
 String[] logFiles = null;
 List amContainersList = new ArrayList();
 String localDir = null;
@@ -115,9 +132,11 @@ public class LogsCLI extends Configured implements Tool {
   nodeAddress = commandLine.getOptionValue(NODE_ADDRESS_OPTION);
   appOwner = commandLine.getOptionValue(APP_OWNER_OPTION);
   getAMContainerLogs = commandLine.hasOption(AM_CONTAINER_OPTION);
-  showMetaInfo = commandLine.hasOption(SHOW_META_INFO);
   nodesList = commandLine.hasOption(LIST_NODES_OPTION);
   localDir = commandLine.getOptionValue(OUT_OPTION);
+  showApplicationLogInfo = commandLine.hasOption(
+  SHOW_APPLICATION_LOG_INFO);
+  showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
   if (getAMContainerLogs) {
 try {
   amContainersList = parseAMContainer(commandLine, printOpts);
@@ -172,6 +191,12 @@ public class LogsCLI extends Configured implements Tool {
   }
 }
 
+if (showApplicationLogInfo && showContainerLogInfo) {
+  System.err.println("Invalid options. Can only accept one of "
+  + "show_application_log_info/show_container_log_info.");
+  return -1;
+}
+
 LogCLIHelpers logCliHelper = new LogCLIHelpers();
 logCliHelper.setConf(getConf());
 
@@ -215,14 +240,17 @@ public class LogsCLI extends Configured implements Tool {
 isApplicationFinished(appState), appOwner, nodeAddress, null,
 containerIdStr, localDir, logs, bytes);
 
-if 

hadoop git commit: YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose logs are aggregated via a "show_container_log_info" option. Contributed by Xuan Gong.

2016-07-13 Thread vinodkv
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 694b4abbc -> 4a6cef8c9


YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose 
logs are aggregated via a "show_container_log_info" option. Contributed by Xuan 
Gong.

(cherry picked from commit eb471632349deac4b62f8dec853c8ceb64c9617a)


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

Branch: refs/heads/branch-2
Commit: 4a6cef8c910548251bec336147ee4be65736102a
Parents: 694b4ab
Author: Vinod Kumar Vavilapalli 
Authored: Wed Jul 13 10:47:43 2016 -0700
Committer: Vinod Kumar Vavilapalli 
Committed: Wed Jul 13 10:55:18 2016 -0700

--
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 321 ++-
 .../hadoop/yarn/client/cli/TestLogsCLI.java |  85 +++--
 .../logaggregation/AggregatedLogFormat.java |  13 +-
 .../yarn/logaggregation/LogCLIHelpers.java  |  97 +-
 4 files changed, 392 insertions(+), 124 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4a6cef8c/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 7194cd0..ce26bd0 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
@@ -78,14 +78,30 @@ public class LogsCLI extends Configured implements Tool {
   private static final String APP_OWNER_OPTION = "appOwner";
   private static final String AM_CONTAINER_OPTION = "am";
   private static final String CONTAINER_LOG_FILES = "logFiles";
-  private static final String SHOW_META_INFO = "show_meta_info";
   private static final String LIST_NODES_OPTION = "list_nodes";
+  private static final String SHOW_APPLICATION_LOG_INFO
+  = "show_application_log_info";
+  private static final String SHOW_CONTAINER_LOG_INFO
+  = "show_container_log_info";
   private static final String OUT_OPTION = "out";
   private static final String SIZE_OPTION = "size";
   public static final String HELP_CMD = "help";
+  private PrintStream outStream = System.out;
+  private YarnClient yarnClient = null;
 
   @Override
   public int run(String[] args) throws Exception {
+try {
+  yarnClient = createYarnClient();
+  return runCommand(args);
+} finally {
+  if (yarnClient != null) {
+yarnClient.close();
+  }
+}
+  }
+
+  private int runCommand(String[] args) throws Exception {
 Options opts = createCommandOpts();
 Options printOpts = createPrintOpts(opts);
 if (args.length < 1) {
@@ -102,8 +118,9 @@ public class LogsCLI extends Configured implements Tool {
 String nodeAddress = null;
 String appOwner = null;
 boolean getAMContainerLogs = false;
-boolean showMetaInfo = false;
 boolean nodesList = false;
+boolean showApplicationLogInfo = false;
+boolean showContainerLogInfo = false;
 String[] logFiles = null;
 List amContainersList = new ArrayList();
 String localDir = null;
@@ -115,9 +132,11 @@ public class LogsCLI extends Configured implements Tool {
   nodeAddress = commandLine.getOptionValue(NODE_ADDRESS_OPTION);
   appOwner = commandLine.getOptionValue(APP_OWNER_OPTION);
   getAMContainerLogs = commandLine.hasOption(AM_CONTAINER_OPTION);
-  showMetaInfo = commandLine.hasOption(SHOW_META_INFO);
   nodesList = commandLine.hasOption(LIST_NODES_OPTION);
   localDir = commandLine.getOptionValue(OUT_OPTION);
+  showApplicationLogInfo = commandLine.hasOption(
+  SHOW_APPLICATION_LOG_INFO);
+  showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
   if (getAMContainerLogs) {
 try {
   amContainersList = parseAMContainer(commandLine, printOpts);
@@ -172,6 +191,12 @@ public class LogsCLI extends Configured implements Tool {
   }
 }
 
+if (showApplicationLogInfo && showContainerLogInfo) {
+  System.err.println("Invalid options. Can only accept one of "
+  + "show_application_log_info/show_container_log_info.");
+  return -1;
+}
+
 LogCLIHelpers logCliHelper = new LogCLIHelpers();
 logCliHelper.setConf(getConf());
 
@@ -215,14 +240,17 @@ public class LogsCLI extends 

hadoop git commit: YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose logs are aggregated via a "show_container_log_info" option. Contributed by Xuan Gong.

2016-07-13 Thread vinodkv
Repository: hadoop
Updated Branches:
  refs/heads/trunk 56142171b -> eb4716323


YARN-5200. Enhanced "yarn logs" to be able to get a list of containers whose 
logs are aggregated via a "show_container_log_info" option. 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/eb471632
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/eb471632
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/eb471632

Branch: refs/heads/trunk
Commit: eb471632349deac4b62f8dec853c8ceb64c9617a
Parents: 5614217
Author: Vinod Kumar Vavilapalli 
Authored: Wed Jul 13 10:47:43 2016 -0700
Committer: Vinod Kumar Vavilapalli 
Committed: Wed Jul 13 10:54:15 2016 -0700

--
 .../apache/hadoop/yarn/client/cli/LogsCLI.java  | 321 ++-
 .../hadoop/yarn/client/cli/TestLogsCLI.java |  85 +++--
 .../logaggregation/AggregatedLogFormat.java |  13 +-
 .../yarn/logaggregation/LogCLIHelpers.java  |  97 +-
 4 files changed, 392 insertions(+), 124 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/hadoop/blob/eb471632/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 79401b1..31395be 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
@@ -78,14 +78,30 @@ public class LogsCLI extends Configured implements Tool {
   private static final String APP_OWNER_OPTION = "appOwner";
   private static final String AM_CONTAINER_OPTION = "am";
   private static final String CONTAINER_LOG_FILES = "logFiles";
-  private static final String SHOW_META_INFO = "show_meta_info";
   private static final String LIST_NODES_OPTION = "list_nodes";
+  private static final String SHOW_APPLICATION_LOG_INFO
+  = "show_application_log_info";
+  private static final String SHOW_CONTAINER_LOG_INFO
+  = "show_container_log_info";
   private static final String OUT_OPTION = "out";
   private static final String SIZE_OPTION = "size";
   public static final String HELP_CMD = "help";
+  private PrintStream outStream = System.out;
+  private YarnClient yarnClient = null;
 
   @Override
   public int run(String[] args) throws Exception {
+try {
+  yarnClient = createYarnClient();
+  return runCommand(args);
+} finally {
+  if (yarnClient != null) {
+yarnClient.close();
+  }
+}
+  }
+
+  private int runCommand(String[] args) throws Exception {
 Options opts = createCommandOpts();
 Options printOpts = createPrintOpts(opts);
 if (args.length < 1) {
@@ -102,8 +118,9 @@ public class LogsCLI extends Configured implements Tool {
 String nodeAddress = null;
 String appOwner = null;
 boolean getAMContainerLogs = false;
-boolean showMetaInfo = false;
 boolean nodesList = false;
+boolean showApplicationLogInfo = false;
+boolean showContainerLogInfo = false;
 String[] logFiles = null;
 List amContainersList = new ArrayList();
 String localDir = null;
@@ -115,9 +132,11 @@ public class LogsCLI extends Configured implements Tool {
   nodeAddress = commandLine.getOptionValue(NODE_ADDRESS_OPTION);
   appOwner = commandLine.getOptionValue(APP_OWNER_OPTION);
   getAMContainerLogs = commandLine.hasOption(AM_CONTAINER_OPTION);
-  showMetaInfo = commandLine.hasOption(SHOW_META_INFO);
   nodesList = commandLine.hasOption(LIST_NODES_OPTION);
   localDir = commandLine.getOptionValue(OUT_OPTION);
+  showApplicationLogInfo = commandLine.hasOption(
+  SHOW_APPLICATION_LOG_INFO);
+  showContainerLogInfo = commandLine.hasOption(SHOW_CONTAINER_LOG_INFO);
   if (getAMContainerLogs) {
 try {
   amContainersList = parseAMContainer(commandLine, printOpts);
@@ -172,6 +191,12 @@ public class LogsCLI extends Configured implements Tool {
   }
 }
 
+if (showApplicationLogInfo && showContainerLogInfo) {
+  System.err.println("Invalid options. Can only accept one of "
+  + "show_application_log_info/show_container_log_info.");
+  return -1;
+}
+
 LogCLIHelpers logCliHelper = new LogCLIHelpers();
 logCliHelper.setConf(getConf());
 
@@ -215,14 +240,17 @@ public class LogsCLI extends Configured implements Tool {
 isApplicationFinished(appState), appOwner,