hudson.model.Run.getLog()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中hudson.model.Run.getLog方法的一些代码示例,展示了Run.getLog的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Run.getLog方法的具体详情如下:
包路径:hudson.model.Run
类名称:Run
方法名:getLog

Run.getLog介绍

[英]Gets the log of the build as a string.
[中]

代码示例

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

public List<String> superGetLog(int maxLines) throws IOException {
  return super.getLog(maxLines);
}

代码示例来源:origin: jenkinsci/ghprb-plugin

public String postBuildComment(Run<?, ?> build, TaskListener listener) {
  StringBuilder msg = new StringBuilder();
  GHCommitState state = Ghprb.getState(build);
  int numLines = getDescriptor().getLogExcerptLinesDefault(this);
  if (state != GHCommitState.SUCCESS && numLines > 0) {
    // on failure, append an excerpt of the build log
    try {
      // wrap log in "code" markdown
      msg.append("\n\n**Build Log**\n*last ").append(numLines).append(" lines*\n");
      msg.append("\n ```\n");
      List<String> log = build.getLog(numLines);
      for (String line : log) {
        msg.append(line).append('\n');
      }
      msg.append("```\n");
    } catch (IOException ex) {
      listener.getLogger().println("Can't add log excerpt to commit comments");
      ex.printStackTrace(listener.getLogger());
    }
  }
  return msg.toString();
}

代码示例来源:origin: org.jenkins-ci.plugins/python-wrapper

@Override
public List<String> getLog(int maxLines) throws IOException {
  initPython();
  if (pexec.isImplemented(63)) {
    return (List) pexec.execPython("get_log", DataConvertor.fromInt(maxLines));
  } else {
    return super.getLog(maxLines);
  }
}

代码示例来源:origin: jenkinsci/ghprb-plugin

List<String> buildLog = build.getLog(MAX_LINES_COUNT);

代码示例来源:origin: jenkinsci/build-failure-analyzer-plugin

@Override
  public void run() {
    if (performedBuilds.add(build)) { //if add returns false it means the build was already present in the set.
      FailureCauseBuildAction action = build.getAction(FailureCauseBuildAction.class);
      if (action != null) {
        try {
          List<String> log = build.getLog(Integer.MAX_VALUE);
          for (FoundFailureCause cause : action.getFoundFailureCauses()) {
            for (FoundIndication indication : cause.getIndications()) {
              indication.convertFromLineNumber(log);
            }
          }
          build.save();
        } catch (IOException e) {
          logger.log(Level.SEVERE, "Failed to convert FoundIndications in "
              + build.getFullDisplayName(), e);
        }
      }
    }
  }
}

相关文章

微信公众号

最新文章

更多

Run类方法