Jenkins Pipeline: Enable timestamps in build log console
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
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
I'm wondering why @roomsg 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 answering for Q. So,in case you have access as admin you can set it for all pipeline jobs through GUI