当前位置: 首页>>代码示例>>Java>>正文


Java LogCLIHelpers.dumpAContainersLogsForALogType方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.logaggregation.LogCLIHelpers.dumpAContainersLogsForALogType方法的典型用法代码示例。如果您正苦于以下问题:Java LogCLIHelpers.dumpAContainersLogsForALogType方法的具体用法?Java LogCLIHelpers.dumpAContainersLogsForALogType怎么用?Java LogCLIHelpers.dumpAContainersLogsForALogType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.logaggregation.LogCLIHelpers的用法示例。


在下文中一共展示了LogCLIHelpers.dumpAContainersLogsForALogType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: printContainerLogsFromRunningApplication

import org.apache.hadoop.yarn.logaggregation.LogCLIHelpers; //导入方法依赖的package包/类
private void printContainerLogsFromRunningApplication(Configuration conf,
    String appId, String containerIdStr, String nodeHttpAddress,
    String nodeId, String[] logFiles, LogCLIHelpers logCliHelper,
    String appOwner) throws IOException {
  String [] requestedLogFiles = logFiles;
  // fetch all the log files for the container
  if (fetchAllLogFiles(logFiles)) {
    requestedLogFiles =
        getContainerLogFiles(getConf(), containerIdStr, nodeHttpAddress);
  }
  Client webServiceClient = Client.create();
  String containerString = "\n\nContainer: " + containerIdStr;
  System.out.println(containerString);
  System.out.println(StringUtils.repeat("=", containerString.length()));

  for (String logFile : requestedLogFiles) {
    System.out.println("LogType:" + logFile);
    System.out.println("Log Upload Time:"
        + Times.format(System.currentTimeMillis()));
    System.out.println("Log Contents:");
    try {
      WebResource webResource =
          webServiceClient.resource(WebAppUtils.getHttpSchemePrefix(conf)
              + nodeHttpAddress);
      ClientResponse response =
          webResource.path("ws").path("v1").path("node")
            .path("containerlogs").path(containerIdStr).path(logFile)
            .accept(MediaType.TEXT_PLAIN).get(ClientResponse.class);
      System.out.println(response.getEntity(String.class));
      System.out.println("End of LogType:" + logFile);
    } catch (ClientHandlerException | UniformInterfaceException ex) {
      System.out.println("Can not find the log file:" + logFile
          + " for the container:" + containerIdStr + " in NodeManager:"
          + nodeId);
    }
  }
  // for the case, we have already uploaded partial logs in HDFS
  logCliHelper.dumpAContainersLogsForALogType(appId, containerIdStr, nodeId,
    appOwner, Arrays.asList(requestedLogFiles));
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:41,代码来源:LogsCLI.java

示例2: printContainerLogsForFinishedApplication

import org.apache.hadoop.yarn.logaggregation.LogCLIHelpers; //导入方法依赖的package包/类
private void printContainerLogsForFinishedApplication(String appId,
    String containerId, String nodeAddress, String[] logFiles,
    LogCLIHelpers logCliHelper, String appOwner) throws IOException {
  String containerString = "\n\nContainer: " + containerId;
  System.out.println(containerString);
  System.out.println(StringUtils.repeat("=", containerString.length()));
  logCliHelper.dumpAContainersLogsForALogType(appId, containerId,
    nodeAddress, appOwner, logFiles != null ? Arrays.asList(logFiles) : null);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:LogsCLI.java


注:本文中的org.apache.hadoop.yarn.logaggregation.LogCLIHelpers.dumpAContainersLogsForALogType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。