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

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

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

Run.getLogFile介绍

[英]Returns the log file.
[中]返回日志文件。

代码示例

代码示例来源:origin: jenkinsci/jenkins

private OutputStream createLogger() throws IOException {
  // don't do buffering so that what's written to the listener
  // gets reflected to the file immediately, which can then be
  // served to the browser immediately
  try {
    return Files.newOutputStream(getLogFile().toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
  } catch (InvalidPathException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the log of the build as a string.
 * @return Returns the log or an empty string if it has not been found
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public @Nonnull String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns an input stream that reads from the log file.
 * It will use a gzip-compressed log file (log.gz) if that exists.
 *
 * @throws IOException 
 * @return An input stream from the log file. 
 *   If the log file does not exist, the error message will be returned to the output.
 * @since 1.349
 */
public @Nonnull InputStream getLogInputStream() throws IOException {
  File logFile = getLogFile();
  
  if (logFile.exists() ) {
    // Checking if a ".gz" file was return
    try {
      InputStream fis = Files.newInputStream(logFile.toPath());
      if (logFile.getName().endsWith(".gz")) {
        return new GZIPInputStream(fis);
      } else {
        return fis;
      }
    } catch (InvalidPathException e) {
      throw new IOException(e);
    }
  }
  
  String message = "No such file: " + logFile;
  return new ByteArrayInputStream(charset != null ? message.getBytes(charset) : message.getBytes());
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 * @return A {@link Run} log with annotations
 */   
public @Nonnull AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}

代码示例来源:origin: jenkinsci/jenkins

final List<Byte> bytes = new ArrayList<>();
try (RandomAccessFile fileHandler = new RandomAccessFile(getLogFile(), "r")) {
  long fileLength = fileHandler.length() - 1;

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

private OutputStream createLogger() throws IOException {
  // don't do buffering so that what's written to the listener
  // gets reflected to the file immediately, which can then be
  // served to the browser immediately
  try {
    return Files.newOutputStream(getLogFile().toPath(), StandardOpenOption.CREATE, StandardOpenOption.APPEND);
  } catch (InvalidPathException e) {
    throw new IOException(e);
  }
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Gets the log of the build as a string.
 * @return Returns the log or an empty string if it has not been found
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public @Nonnull String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11. Use {@link #getLog(int)} instead as it
 * avoids loading the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(), getCharset());
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the log of the build as a string.
 *
 * @deprecated since 2007-11-11.
 *     Use {@link #getLog(int)} instead as it avoids loading
 *     the whole log into memory unnecessarily.
 */
@Deprecated
public String getLog() throws IOException {
  return Util.loadFile(getLogFile(),getCharset());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework

/**
 * Get entire log file (this method is deprecated in hudson.model.Run,
 * but in tests it is OK to load entire log).
 */
protected static String getLog(Run run) throws IOException {
  return Util.loadFile(run.getLogFile(), run.getCharset());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness

/**
 * Get entire log file (this method is deprecated in hudson.model.Run,
 * but in tests it is OK to load entire log).
 */
protected static String getLog(Run run) throws IOException {
  return Util.loadFile(run.getLogFile(), run.getCharset());
}

代码示例来源:origin: org.eclipse.hudson/hudson-test-framework

/**
 * Get entire log file (this method is deprecated in hudson.model.Run, but
 * in tests it is OK to load entire log).
 */
protected static String getLog(Run run) throws IOException {
  return Util.loadFile(run.getLogFile(), run.getCharset());
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 * @return A {@link Run} log with annotations
 */   
public @Nonnull AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 */
public AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 */
public AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}

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

/**
 * Checks that log size is in limits.
 *
 * @param build the build
 * @return true if size is in limit.
 */
public static boolean isSizeInLimit(Run build) {
  return getInstance().getMaxLogSize() == 0
      || getInstance().getMaxLogSize() > (build.getLogFile().length() / BYTES_IN_MEGABYTE);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 */
public AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(),getCharset(),!isLogUpdated(),this);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Used to URL-bind {@link AnnotatedLargeText}.
 */
public AnnotatedLargeText getLogText() {
  return new AnnotatedLargeText(getLogFile(), getCharset(), !isLogUpdated(), this);
}

相关文章

微信公众号

最新文章

更多

Run类方法