11package com .github .dockerjava .api .command ;
22
3+ import com .github .dockerjava .api .DockerClient ;
34import com .github .dockerjava .api .NotFoundException ;
45
56import java .io .InputStream ;
67
78/**
89 * Get container logs
9- *
10+ *
1011 * @param followStream
1112 * - true or false, return stream. Defaults to false.
1213 * @param stdout
1718 * - true or false, if true, print timestamps for every log line.
1819 * Defaults to false.
1920 * @param tail
20- * - `all` or `<number>`, Output specified number of lines at the end of logs
21- *
22- * Consider wrapping any input stream you get with a frame reader to make reading frame easier.
23- *
21+ * - `all` or `<number>`, Output specified number of lines at the end
22+ * of logs
23+ *
24+ * Consider wrapping any input stream you get with a frame reader to
25+ * make reading frame easier.
26+ *
2427 * @see com.github.dockerjava.core.command.FrameReader
2528 */
26- public interface LogContainerCmd extends DockerCmd <InputStream >{
29+ public interface LogContainerCmd extends DockerCmd <InputStream > {
2730
2831 public String getContainerId ();
2932
@@ -39,12 +42,21 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
3942
4043 public LogContainerCmd withContainerId (String containerId );
4144
45+ /**
46+ * See {@link #withFollowStream(boolean)}
47+ */
4248 public LogContainerCmd withFollowStream ();
4349
50+ /**
51+ * Following the stream means the resulting {@link InputStream} returned by
52+ * {@link #exec()} reads infinitely. So a {@link InputStream#read()} MAY
53+ * BLOCK FOREVER as long as no data is streamed from the docker host to
54+ * {@link DockerClient}!
55+ */
4456 public LogContainerCmd withFollowStream (boolean followStream );
4557
4658 public LogContainerCmd withTimestamps ();
47-
59+
4860 public LogContainerCmd withTimestamps (boolean timestamps );
4961
5062 public LogContainerCmd withStdOut ();
@@ -60,16 +72,17 @@ public interface LogContainerCmd extends DockerCmd<InputStream>{
6072 public LogContainerCmd withTail (int tail );
6173
6274 /**
63- * Its the responsibility of the caller to consume and/or close the {@link InputStream} to prevent
64- * connection leaks.
65- *
66- * @throws NotFoundException No such container
75+ * Its the responsibility of the caller to consume and/or close the
76+ * {@link InputStream} to prevent connection leaks.
77+ *
78+ * @throws NotFoundException
79+ * No such container
6780 */
6881 @ Override
6982 public InputStream exec () throws NotFoundException ;
70-
71- public static interface Exec extends DockerCmdExec <LogContainerCmd , InputStream > {
72- }
7383
84+ public static interface Exec extends
85+ DockerCmdExec <LogContainerCmd , InputStream > {
86+ }
7487
7588}
0 commit comments