本文整理汇总了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();
}
示例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);
}
示例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();
}
}
示例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;
}