Package org.jvnet.hudson.test
Class TailLog
java.lang.Object
org.jvnet.hudson.test.TailLog
- All Implemented Interfaces:
AutoCloseable
Utility to display the log of a build in real time.
Unlike
BuildWatcher
, this works well with both RealJenkinsRule
and LocalData
.
Use in a try
-with-resources block, typically calling waitForCompletion()
at the end.-
Constructor Summary
ConstructorDescriptionTailLog
(hudson.model.Run<?, ?> b) Watch a build already loaded in the current JVM.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
Modifier and TypeMethodDescriptionvoid
close()
void
Applies ANSI coloration to log lines produced by this instance.
-
Constructor Details
-
TailLog
public TailLog(hudson.model.Run<?, ?> b) Watch a build already loaded in the current JVM. -
TailLog
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
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()
-
TailLog
Watch a build expected to run at a specific file location.- Parameters:
buildDirectory
- expectedRun.getRootDir()
job
- aAbstractItem.getFullName()
-
-
Method Details
-
withColor
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
- Throws:
InterruptedException
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-