lanoxx
lanoxx

Reputation: 13051

Jenkins Pipeline: Enable timestamps in build log console

How can I display build timestamps for each line of a multi-branch pipeline project? Is it a supported feature? If yes, does it need to be enabled in the Jenkinsfile or is there a GUI option?

Upvotes: 85

Views: 81681

Answers (4)

fl0w
fl0w

Reputation: 3877

To enable Timestamper globally (all builds):

  • Go to the Jenkins configuration
  • Go to the "Timestamper" configuration

-> Select the "Enabled for all Pipeline builds" checkbox.

Upvotes: 2

soninob
soninob

Reputation: 456

I'm wondering why roomsg's comment on the accepted answer didn't become an answer.

I just noticed that (at least in our setup) you can configure this globally: check the "Enabled for all Pipeline builds" in the "Timestamper" section in Jenkins configuration

I think this is the best answer for the question. So, in case you have access as admin, you can set it for all pipeline jobs through GUI.

Upvotes: 8

Samer Makary
Samer Makary

Reputation: 1915

Adding options to the declarative pipeline

pipeline {
  agent any
  options { timestamps () }
  // stages and rest of pipeline.
}

Credit goes to the comment above Jenkins Pipeline: Enable timestamps in build log console

Upvotes: 125

wojciech_rak
wojciech_rak

Reputation: 2346

For scripted pipeline just wrap your script in timestamps { } Eg.

timestamps {
  // do your job
}

Note: You must have the timestamper plugin installed: wiki.jenkins.io/display/JENKINS/Timestamper

Upvotes: 62

Related Questions