Madeline Scyphers
09/10/2025, 4:27 PMJames Fellows Yates
09/10/2025, 6:53 PMJames Fellows Yates
09/10/2025, 6:53 PM-log parameterJames Fellows Yates
09/10/2025, 6:54 PMPhil Ewels
09/10/2025, 7:20 PMPhil Ewels
09/10/2025, 7:20 PMMadeline Scyphers
09/10/2025, 9:27 PMworkflow.onComplete, such as inside workflow PIPELINE_COMPLETION ‘s workflow.onComplete add
def logFile = file('.nextflow.log')
if (outdir && logFile.exists()) {
def newLoc = file(outdir).resolve('.nextflow.log')
log.debug("Moving .nextflow.log to: ${newLoc}")
Files.copy(logFile, newLoc, StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES)
}
and add
import java.nio.file.Files
import java.nio.file.StandardCopyOption
at the top of the file.
Which of course won’t always work, like if the pipeline was killed and wasn’t able to do do a graceful exit, but most of the time does it. And you can still tell people about the edge cases (or put a placeholder that says check launch directory if this file doesn’t get populated or something, or even copy periodically but that seems not necessary)Thomas Danhorn
09/13/2025, 2:08 AMcp -a .nextflow.log /path/to/outdir/nextflow_$(date -Is).log at the end of it. That seems more simple and flexible than messing with workflow.onComplete.