Package org.jvnet.hudson.test
Class TailLog
- java.lang.Object
-
- org.jvnet.hudson.test.TailLog
-
- All Implemented Interfaces:
AutoCloseable
public final class TailLog extends Object implements AutoCloseable
Utility to display the log of a build in real time. UnlikeBuildWatcher
, this works well with bothRealJenkinsRule
andLocalData
. Use in atry
-with-resources block, typically callingwaitForCompletion()
at the end.
-
-
Constructor Summary
Constructors Constructor Description TailLog(hudson.model.Run<?,?> b)
Watch a build already loaded in the current JVM.TailLog(File buildDirectory, String job, int number)
Watch a build expected to run at a specific file location.TailLog(JenkinsRule jr, String job, int number)
Watch a build expected to be loaded in the current JVM.TailLog(RealJenkinsRule rjr, String job, int number)
Watch a build expected to be loaded in a controller JVM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
waitForCompletion()
TailLog
withColor(PrefixedOutputStream.AnsiColor color)
Applies ANSI coloration to log lines produced by this instance.
-
-
-
Constructor Detail
-
TailLog
public TailLog(hudson.model.Run<?,?> b)
Watch a build already loaded in the current JVM.
-
TailLog
public TailLog(JenkinsRule jr, String job, int number)
Watch a build expected to be loaded in the current JVM. Note: this constructor will not work for a branch project (child ofMultiBranchProject
).- Parameters:
job
- aAbstractItem.getFullName()
-
TailLog
public TailLog(RealJenkinsRule rjr, String job, int number)
Watch a build expected to be loaded in a controller JVM. Note: this constructor will not work for a branch project (child ofMultiBranchProject
).- Parameters:
job
- aAbstractItem.getFullName()
-
-
Method Detail
-
withColor
public TailLog withColor(PrefixedOutputStream.AnsiColor color)
Applies ANSI coloration to log lines produced by this instance. Ignored when on CI. Does not work when the build has already started by the time this method is called.
-
waitForCompletion
public void waitForCompletion() throws InterruptedException
- Throws:
InterruptedException
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-