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


Java LogContainerCmd.withStdErr方法代码示例

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


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

示例1: run

import com.github.dockerjava.api.command.LogContainerCmd; //导入方法依赖的package包/类
@Override
protected Stream<LogEntry> run() throws Exception {
  LogContainerCmd cmd = dockerClient.logContainerCmd(containerId);
  if (params.isWithStdOut()) {
    cmd.withStdOut(true);
  }
  if (params.isWithStdErr()) {
    cmd.withStdErr(true);
  }
  if (params.isWithTimestamps()) {
    cmd.withTimestamps(true);
  }
  if (params.getTail() > 0) {
    cmd.withTail(params.getTail());
  }

  LogContainerCallback callBack = new LogContainerCallback();
  Sssh.waitForCompletion(cmd.exec(callBack));
  return callBack.entries.stream();
}
 
开发者ID:Qorr,项目名称:Hvalspik,代码行数:21,代码来源:GetContainerLogsCommand.java

示例2: followOutput

import com.github.dockerjava.api.command.LogContainerCmd; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void followOutput(DockerClient dockerClient, String containerId,
                         Consumer<OutputFrame> consumer, OutputFrame.OutputType... types) {

    final LogContainerCmd cmd = dockerClient.logContainerCmd(containerId)
            .withFollowStream(true)
            .withSince(0);

    final FrameConsumerResultCallback callback = new FrameConsumerResultCallback();
    for (OutputFrame.OutputType type : types) {
        callback.addConsumer(type, consumer);
        if (type == STDOUT) cmd.withStdOut(true);
        if (type == STDERR) cmd.withStdErr(true);
    }

    cmd.exec(callback);
}
 
开发者ID:testcontainers,项目名称:testcontainers-java,代码行数:20,代码来源:LogUtils.java

示例3: copyLog

import com.github.dockerjava.api.command.LogContainerCmd; //导入方法依赖的package包/类
public void copyLog(String containerId, boolean follow, boolean stdout, boolean stderr, boolean timestamps, int tail,
    OutputStream outputStream) throws IOException {
    this.readWriteLock.readLock().lock();
    try {
        LogContainerCmd logContainerCmd =
            dockerClient.logContainerCmd(containerId).withStdErr(false).withStdOut(false);

        logContainerCmd.withFollowStream(follow);
        logContainerCmd.withStdOut(stdout);
        logContainerCmd.withStdErr(stderr);
        logContainerCmd.withTimestamps(timestamps);

        if (tail < 0) {
            logContainerCmd.withTailAll();
        } else {
            logContainerCmd.withTail(tail);
        }

        OutputStreamLogsResultCallback outputStreamLogsResultCallback =
            new OutputStreamLogsResultCallback(outputStream);
        logContainerCmd.exec(outputStreamLogsResultCallback);
        try {
            outputStreamLogsResultCallback.awaitCompletion();
        } catch (InterruptedException e) {
            throw new IOException(e);
        }
    } finally {
        this.readWriteLock.readLock().unlock();
    }
}
 
开发者ID:arquillian,项目名称:arquillian-cube,代码行数:31,代码来源:DockerClientExecutor.java

示例4: executeLogContainerRequest

import com.github.dockerjava.api.command.LogContainerCmd; //导入方法依赖的package包/类
/**
 * Produce a log container request
 *
 * @param client
 * @param message
 * @return
 */
private LogContainerCmd executeLogContainerRequest(DockerClient client, Message message) {

    LOGGER.debug("Executing Docker Log Container Request");

    String containerId = DockerHelper.getProperty(DockerConstants.DOCKER_CONTAINER_ID, configuration, message, String.class);

    ObjectHelper.notNull(containerId, "Container ID must be specified");

    LogContainerCmd logContainerCmd = client.logContainerCmd(containerId);

    Boolean followStream = DockerHelper.getProperty(DockerConstants.DOCKER_FOLLOW_STREAM, configuration, message, Boolean.class);

    if (followStream != null) {
        logContainerCmd.withFollowStream(followStream);
    }

    Boolean stdErr = DockerHelper.getProperty(DockerConstants.DOCKER_STD_ERR, configuration, message, Boolean.class);

    if (stdErr != null) {
        logContainerCmd.withStdErr(stdErr);
    }

    Boolean stdOut = DockerHelper.getProperty(DockerConstants.DOCKER_STD_OUT, configuration, message, Boolean.class);

    if (stdOut != null) {
        logContainerCmd.withStdOut(stdOut);
    }

    Integer tail = DockerHelper.getProperty(DockerConstants.DOCKER_TAIL, configuration, message, Integer.class);

    if (tail != null) {
        logContainerCmd.withTail(tail);
    }

    Boolean tailAll = DockerHelper.getProperty(DockerConstants.DOCKER_TAIL_ALL, configuration, message, Boolean.class);

    if (tailAll != null && tailAll) {
        logContainerCmd.withTailAll();
    }

    Boolean timestamps = DockerHelper.getProperty(DockerConstants.DOCKER_TIMESTAMPS, configuration, message, Boolean.class);

    if (timestamps != null) {
        logContainerCmd.withTimestamps(timestamps);
    }

    return logContainerCmd;

}
 
开发者ID:HydAu,项目名称:Camel,代码行数:57,代码来源:DockerProducer.java


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