Class FileLogStorage
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.log.FileLogStorage
-
- All Implemented Interfaces:
LogStorage
@Restricted(org.kohsuke.accmod.restrictions.Beta.class) public final class FileLogStorage extends Object implements LogStorage
Simple implementation of log storage in a single file that maintains a side file with an index indicating where node transitions occur. Each line in the index file is a byte offset, optionally followed by a space and then a node ID.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static LogStorage
forFile(File log)
File
getLogFile(FlowExecutionOwner.Executable build, boolean complete)
Deprecated.TaskListener
nodeListener(FlowNode node)
Provides an alternate way of emitting output from a node (such as a step).BuildListener
overallListener()
Provides an alternate way of emitting output from a build.AnnotatedLargeText<FlowExecutionOwner.Executable>
overallLog(FlowExecutionOwner.Executable build, boolean complete)
Provides an alternate way of retrieving output from a build.AnnotatedLargeText<FlowNode>
stepLog(FlowNode node, boolean complete)
Provides an alternate way of retrieving output from a build.
-
-
-
Method Detail
-
forFile
public static LogStorage forFile(File log)
-
overallListener
@NonNull public BuildListener overallListener() throws IOException
Description copied from interface:LogStorage
Provides an alternate way of emitting output from a build.May implement
AutoCloseable
to clean up at the end of a build; it may or may not be closed during Jenkins shutdown while a build is running.The caller may wrap the result using
TaskListenerDecorator.apply(hudson.model.TaskListener, org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner, org.jenkinsci.plugins.workflow.log.TaskListenerDecorator)
.- Specified by:
overallListener
in interfaceLogStorage
- Returns:
- a (remotable) build listener; do not bother overriding anything except
TaskListener.getLogger()
- Throws:
IOException
- See Also:
FlowExecutionOwner.getListener()
-
nodeListener
@NonNull public TaskListener nodeListener(@NonNull FlowNode node) throws IOException
Description copied from interface:LogStorage
Provides an alternate way of emitting output from a node (such as a step).May implement
AutoCloseable
to clean up at the end of a node (FlowNode.isActive()
); it may or may not be closed during Jenkins shutdown while a build is running.The caller may wrap the result using
TaskListenerDecorator.apply(hudson.model.TaskListener, org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner, org.jenkinsci.plugins.workflow.log.TaskListenerDecorator)
.- Specified by:
nodeListener
in interfaceLogStorage
- Parameters:
node
- a running node- Returns:
- a (remotable) task listener; do not bother overriding anything except
TaskListener.getLogger()
- Throws:
IOException
- See Also:
StepContext.get(java.lang.Class<T>)
-
overallLog
@NonNull public AnnotatedLargeText<FlowExecutionOwner.Executable> overallLog(@NonNull FlowExecutionOwner.Executable build, boolean complete)
Description copied from interface:LogStorage
Provides an alternate way of retrieving output from a build.In an
AnnotatedLargeText.writeHtmlTo(long, java.io.Writer)
override,ConsoleAnnotationOutputStream.eol(byte[], int)
should applyLogStorage.startStep(java.lang.String)
andLogStorage.endStep()
to delineate blocks contributed by steps. (Also seeConsoleAnnotators
.)- Specified by:
overallLog
in interfaceLogStorage
complete
- if true, we claim to be serving the complete log for a build, so implementations should be sure to retrieve final log lines- Returns:
- a log
-
stepLog
@NonNull public AnnotatedLargeText<FlowNode> stepLog(@NonNull FlowNode node, boolean complete)
Description copied from interface:LogStorage
Provides an alternate way of retrieving output from a build.- Specified by:
stepLog
in interfaceLogStorage
- Parameters:
node
- a running nodecomplete
- if true, we claim to be serving the complete log for a node, so implementations should be sure to retrieve final log lines- Returns:
- a log for this just this node
- See Also:
LogAction
-
getLogFile
@Deprecated @NonNull public File getLogFile(@NonNull FlowExecutionOwner.Executable build, boolean complete)
Deprecated.Description copied from interface:LogStorage
Provide a file containing the log text. The default implementation creates a temporary file based on the current contents ofLogStorage.overallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
.- Specified by:
getLogFile
in interfaceLogStorage
- Parameters:
build
- as inLogStorage.overallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
complete
- as inLogStorage.overallLog(org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner.Executable, boolean)
- Returns:
- a possibly temporary file
-
-