Skip to end of metadata
Go to start of metadata

Adds timestamps to the Console Output.

Plugin Information

View Timestamper on the plugin site for more information.

Compatible with Java 7 and above.

Example output:

21:51:15  Started by user anonymous
21:51:15  Building on master
21:51:17  Finished: SUCCESS

Instructions

Enable timestamps within the "Build Environment" section of the build's configuration page.

To enable timestamps for multiple builds at once, use the Configuration Slicing Plugin version 1.32 or later.

Instructions: Pipeline Builds

Since Timestamper 1.8

Use the timestamps step to wrap the rest of the pipeline script.

timestamps {
    // some block
}

Since Timestamper 1.7

Prior to Timestamper 1.8, timestamps can only be recorded within a node.

node {
    wrap([$class: 'TimestamperBuildWrapper']) {
        echo 'hello from Workflow'
    }
}

Customization

  • The timestamp format can be configured via the Configure System page.
  • There is a panel on the left-hand side of the console page which allows either the system clock time or the elapsed time to be displayed.
  • The time zone used to display the timestamps can be configured by setting a system parameter as described here: Change time zone.

Scripting

Scripts can read the timestamps from the /timestamps/ URL of each build.

Examples:

  • /timestamps/
    By default, display the elapsed time in seconds with three places after the decimal point.
  • /timestamps/?time=HH:mm:ss&appendLog
    Display the system clock time and append the line from the log.
  • /timestamps/?elapsed=HH:mm:ss.S&appendLog
    Display the elapsed time and append the line from the log.
  • /timestamps/?time=HH:mm:ss&elapsed=HH:mm:ss.S
    Display both the system clock time and the elapsed time.
  • /timestamps/?currentTime&time=HH:mm:ss
    Display the current time on the Jenkins master.

Supported query parameters:

  • time (since 1.8)
    Display the system clock time. Accepts the JDK SimpleDateFormat format.
    The time zone and locale of the Jenkins server will be used, unless they are configured with the timeZone and locale query parameters.
  • elapsed (since 1.8)
    Display the elapsed time since the start of the build. Accepts the commons-lang DurationFormatUtils format.
  • precision (since 1.3.2)
    Display the elapsed time in seconds, with a certain number of places after the decimal point. Accepts a number of decimal places or values such as seconds and milliseconds.
  • appendLog (since 1.8)
    Display the console log line after the timestamp.
  • startLine (since 1.8)
    Display the timestamps starting from a certain line. Accepts a positive integer to start at that line, or a negative integer to start that many lines back from the end.
  • endLine (since 1.8)
    Display the timestamps ending at a certain line. Accepts a positive integer to finish at that line, or a negative integer to finish that many lines back from the end.
  • timeZone (since 1.8)
    Time zone used when displaying the system clock time. Accepts the JDK TimeZone ID format.
  • locale (since 1.8)
    Select the locale to use when displaying the system clock time. Accepts a locale in the format recognised by commons-lang LocaleUtils.toLocale.
  • currentTime (since 1.8.8)
    Display the current time on the Jenkins master instead of reading timestamps from the build.

Reading the timestamps directly from the file system is not recommended, because the format may change.

Java API

Since Timestamper 1.8

Other plugins can add a dependency on the Timestamper plugin, and then use the TimestamperAPI.read method to retrieve the timestamps.
The read method accepts any query string that can be passed to the /timestamps/ URL.

String query = "time=HH:mm:ss";
try (BufferedReader reader = TimestamperAPI.get().read(build, query)) {
    // read timestamps here
}

Release History

New releases may take a few hours to appear in the update center.

1.8.10 (May 9, 2018)

  • Add a forward slash to the URLs opened when clicking "View as plain text". For some web servers, this is necessary to open the correct page. (JENKINS-50713)
  • Hide the "View as plain text" link when viewing a pipeline step because it isn't applicable to this page. (JENKINS-47051)
  • Fix the display of timestamps at the /timestamps/ URL for pipeline builds when not using the appendLog flag. (JENKINS-51106)
  • Use the browser's time zone by default. This only takes affect for new users or after clearing the cookies. (pull request #22)
    Contributed by Wilfred Hughes

1.8.9 (Dec 17, 2017)

  • Remove extra lines from /timestamps/ URL output when log file contains carriage return characters. (JENKINS-46420) (pull request #21)
    Contributed by Darragh Bailey

1.8.8 (Jan 22, 2017)

1.8.7 (Oct 05, 2016)

1.8.6 (Sep 19, 2016)

  • The timestamps are no longer affected by styles applied by the AnsiColor plugin. (JENKINS-34019) (reverted in next release 1.8.7)
  • Console page settings were not appearing for some users. (JENKINS-38085)
  • Prevent unnecessary warning messages from being logged with Timestamper 1.8.5 installed. (JENKINS-38098)

1.8.5 (Aug 31, 2016)

  • Performance: Read from end of log file for finished build (pull request #18)
    Contributed by Akbashev Alexander
  • Improve error reporting when invalid parameters are passed to the /timestamps URL.
  • Requires Java 7 or later.

1.8.4 (Jun 26, 2016)

  • When reading the log file, handle escape characters that do not form part of a console note. (JENKINS-36103)

1.8.3 (Jun 12, 2016)

  • Allow running behind an HTTPS proxy. (JENKINS-35315)
  • Prevent warning messages when workflow-step-api is not installed. (JENKINS-35375)

1.8.2 (May 15, 2016)

  • Make the workflow-step-api dependency optional.

1.8.1 (May 15, 2016)

  • Custom pipeline step for recording timestamps. (JENKINS-30142)
  • Display a link to the raw console output including timestamps. (JENKINS-26794)
  • New query parameters recognised by the /timestamps/ URL: time, elapsed, appendLog, startLine, endLine, timeZone, locale.
  • Java API for retrieving timestamps from other plugins. (JENKINS-21213)
  • The elapsed time is measured from the actual build start time, rather than the scheduled start time.

1.8 (May 15, 2016)

1.7.4 (Jan 31, 2016)

1.7.3 (Jan 13, 2016)

  • Persist the chosen timestamp display settings. This was broken since 1.7.2. (JENKINS-32074)

1.7.2 (Aug 15, 2015)

  • Change cookie path from '/' to the root URL of Jenkins (JENKINS-29899)
    Contributed by Kiyoshi Ohgishi

1.7.1 (Jul 11, 2015)

  • Display the console page settings within the side panel with the other actions. (JENKINS-28948)
  • Support for newer Jenkins to display the settings in the console page. (JENKINS-29361)

1.7 (Jun 24, 2015)

1.6.2 (May 31, 2015)

1.6.1 (May 27, 2015)

1.6 (Mar 11, 2015)

  • Add an option to use the browser's time zone. (pull request #11)
    Contributed by michael1010
  • Japanese translations. (pull request #12)
    Contributed by Pei-Tang Huang

1.5.16 (Feb 25, 2015)

  • Allow clicking on the text labels next to the radio buttons. (JENKINS-27054)
    Contributed by Paul Fee

1.5.15 (Dec 24, 2014)

  • Fix encoding problem with the German translation of the plugin description. (JENKINS-26206)

1.5.14 (Jul 30, 2014)

  • Reduce size of the X-ConsoleAnnotator HTTP header. (JENKINS-23867)
    The header size may have caused problems depending on how your web container is configured.

1.5.13 (Jul 23, 2014)

1.5.12 (Jun 07, 2014)

  • Allow the time zone for the timestamps to be configured. (JENKINS-22586)

1.5.11 (Apr 09, 2014)

1.5.10 (Apr 09, 2014)

1.5.9 (Mar 10, 2014)

1.5.8 (Jan 02, 2014)

  • Implemented a work-around for servers that do not reliably report the elapsed time. (JENKINS-19778)
  • Support for gzipped build logs.
  • Requires Java 6 or later.
  • Requires Jenkins 1.520.

1.5.7 (Aug 21, 2013)

  • Fix minor incompatibility with Publish Over SSH Plugin. (JENKINS-19193)

1.5.6 (Jul 25, 2013)

  • Update the DurationFormatUtils URL in the help messages. (pull request #4)
    Contributed by Bananeweizen

1.5.5 (Jul 24, 2013)

  • Display timestamps correctly when viewing the truncated console log. (JENKINS-17779)
    Contributed by Kohsuke Kawaguchi

1.5.4 (Jun 04, 2013)

1.5.3 (Mar 17, 2013)

  • Traditional Chinese translations. (pull request #2)
    Contributed by Pei-Tang Huang
  • Workaround a bug in Jenkins which causes a VM crash. (JENKINS-16528)
  • Prevent an NPE being thrown when the slave is taken offline during a build. (JENKINS-16778)

1.5.2 (Feb 03, 2013)

1.5.1 (Jan 22, 2013)

1.5 (Jan 05, 2013)

  • Can choose to display either the system clock time, the elapsed time since the build started, or no timestamps at all. (JENKINS-14931)
  • The elapsed time format can be configured.

1.4 (Dec 27, 2012)

  • The timestamp data now requires less disk space and does not clutter the build log file. (JENKINS-14932)
    Upgrade warning:
    If you use a script to read the timestamp data directly from the build log file, you will need to either:
    (a) Modify the script to read from the /timestamps URL instead (recommended) OR
    (b) Provide the -Dtimestamper-consolenotes=true VM argument when starting Jenkins to use the old format.

1.3.2 (Sep 30, 2012)

  • Scripts can read timestamps from the /timestamps URL of each build.
  • Requires Jenkins 1.461.

1.3.1 (Sep 08, 2012)

  • Can configure an empty timestamp format.

1.3 (Aug 26, 2012)

  • The timestamp format is configurable. (pull request #1)
    Contributed by Frederik Fromm
  • Requires Jenkins 1.450.

1.2.2 (Feb 07, 2011)

  • Built from github repository with new Jenkins infrastructure. No behavioural changes.

1.2.1 (Sep 07, 2010)

  • Timestamps no longer interfere with the Ant target highlighting.

1.2 (Aug 29, 2010)

  • More robust implementation; prevents errors that could arise for some build configurations. (JENKINS-7112)
  • Requires Jenkins 1.374.

1.1 (Aug 01, 2010)

1.0 (Jul 31, 2010)

  • Initial release.
  • Requires Jenkins 1.349.

30 Comments

  1. Hi

    I have installed Timestamper 1.2 on Hudson 1.374 but am getting no timestamps in the console output. Do I have to enable it somewhere?

    Best regards

    David

    1. Unknown User (steven brown)

      Hi David,

      It needs to be enabled on the build configuration page.

  2. Unknown User (axel.heider@gi-de.com)

    Nice plugin, unfortunately it does not fully work for matrix projects. Time stamps are shown for the parent only, but nor for the matrix builds.

    1. Unknown User (steven brown)

      Fixed (JENKINS-7868). Upgrade to Hudson 1.383 once it has been released.

  3. Really useful and simple to use plugin, thanks for the work.

    One thing I'd really like is an option to show time since job started, rather than actual system time; and maybe customisable time/date format.

    1. Included in the Timestamper 1.5 release.

  4. I added a script for updating all jobs in one go, checkout Enable Timestamper plugin on all jobs

  5. When using this plugin, instead of seeing plain ascii text in the log file of the file system, I see stuff like this at the beginning of every line:

    [8mha:AAAAdB+LCAAAAAAAAABb85aBtbiIQSOjNKU4P0+vIKc0PTOvWK8kMze1uCQxtyC1SC8ExvbLL0llgABGJgZGLwaB3MycnMzi4My85FTXgvzkjIoiBimoScn5ecX5Oal6zhAaVS9DRQGQNhEu8r8BAF25rrSBAAAA[0mStarted by an SCM change

    Is there a reason for that?  It makes the log file bloated, and on top of that, existing scripts that parse these log files now have to tweaked.  Why can't it just be something along the lines of:

    07:36:02 Started by an SCM change

    BTW, how do you translate that string to its user friendly display ("07:36:02")?

    Thanks!

    1. I found the source code on how Jenkins encodes "regular" text to the garblygook that I'm seeing.  With this code, I can write my own log parser. 

      If you're curious, here is the source code:

      http://grepcode.com/file/repo1.maven.org/maven2/org.jvnet.hudson.main/hudson-core/1.353/hudson/console/ConsoleNote.java

      1. Yes, there was a reason. See JENKINS-14932 for details.

        As of Timestamper 1.3.2, the timestamps should be read from the /timestamps URL of each build instead.
        As of Timestamper 1.4, the timestamp data is no longer recorded in the build log file. (no more garblygook)

  6. Two suggestions:

    • Have an option to show relative times (since start of build) instead of absolutes.
    • Allow configuration of the time format.
      Thanks!
    1. Included in the Timestamper 1.5 release.

      1. Just saw the 1.5 release with the dialog in the left margin. Very cool. Is it better to suggest here or to create ticket?

        The suggestions is to have an additional option for showing the delta in time from one line to the next, e.g. for a log that would look like this:

        0:00:00.0  Job start
        0:00:00.0  First step takes 1.1 seconds
        0:00:01.1  Second step takes 12.4 seconds
        0:00:13.5  Job done

        It would actually look like this:

        0:00:00.0  Job start
        0:00:01.1  First step
        0:00:12.4  Second step
        0:00:13.5  Job done

        1. Thanks Rob. Yeah, I'd prefer the bug tracker.

  7. Have found this plugin VERY USEFUL from time to time . . . thank you.

    Enhancement request: It would be nice if I could give a time in seconds and if the "delta time" between two lines is more than that, then the line(s) is highlighted, bolded, star next to it . . . whatever.  (At least the time, if not the whole line for some reason.)

    It would allow me to easily find those "lines that took a long time" . . . I can of course do it by eyeballing it . . . but it would be nice if the computer would help draw my eye to the important stuff to look at.

    Some of our output is huge . . . looking at the last line tells me something is wrong, it would have been nice to be able to put in something like "300" and have those lines taking 5 minutes or more highlighted.

    Nice if this feature worked in all three display modes.

    Again: Thank you for a great and useful plugin.

    Frank

    1. Frank,

      Excellent expression of the use case I was interested in. Have an input box at the top of the log page that would take the minimum number of seconds to highlight, then highlight those rows that exceed that value.

      More complex (and maybe cooler) would be that it collapses the lines that were less than the limit. For example:

      0:00.0   Start job
      0:00.0   Step 1 (takes 3.0 seconds)
      0:03.0   Step 2 (takes 1.5 seconds)
      0:04.5   Step 3 (takes 144.4 seconds)
      2:28.9   Step 4 (takes 2.4 seconds)
      2:31.3   Step 5 (takes 32.8 seconds)
      3:04.1   End job
      

      If you put in 60 to the selection box, you'd see:

      0:00.0   Start job
      (+) ...
      0:04.5   Step 3 (takes 144.4 seconds)
      (+) ...
      3:04.1   End job
      

      If you put 30 into the selection box, you'd see:

      0:00.0   Start job
      (+) ...
      0:04.5   Step 3 (takes 144.4 seconds)
      (+) ...
      2:31.3   Step 5 (takes 32.8 seconds)
      3:04.1   End job
      
      1. @ Frank Merrow @Rob FagenJun 13, 2013

        I see your posts are old but I too would love a Stopwatch feature on Jenkins. Have you found plugins or is there an issue for this on this project with implementation ideas?

      2. @Frank Merrow & @Rob Fagen who posted Jun 13, 2013

        I see your posts are old but I too would love a Stopwatch feature on Jenkins. Have you found plugins or is there an issue for this on this project with implementation ideas?

  8. Hi,

    could you please add functionality to change color?

    thanks

    1. Already possible by changing the format on the Configure System page. Try something like:

      '<span style="color:blue;">'HH:mm:ss'</span> '
      
  9. This is so cool. Especially in conjunction with the conf slicing plugin.

    It will play a game-changer role in tracking inefficiencies in our jenkins jobs.

  10. We're getting weird output at the bottom of our console:

    buildstep.3

    buildstep.4buildstep.5buildstep.6buildstep.7buildstep.8buildstep.9buildstep.10Collecting metadata...

    1. OK, can you raise a JIRA issue with more details?

  11. Has the ability to switch between System clock time, Elapsed time and None been removed from the sidebar?  I don't see it now that I've updated from 1.7.2 to the latest version 1.8.5.

    1. It hasn't been removed. I've raised JENKINS-38085 for you, and I have some follow-up questions there.

      1. I've added my notes.  It seems like annotator.js can't be loaded because it uses HTTP and I have a "Blocked loading mixed active content" problem running Jenkins under HTTPS.

  12. I've applied version 1.8.6 and now Timestamper is rendering time data as follows 

    when before it rendered like so:

    Is there a way to control that so the text colors aren't inverted?

  13. Hi,

    Java API example has to be updated, as if I use the given example, I am getting an empty buffered reader. We should also add the "appendLog" flag as part of the second parameter (i.e. query), so that you can get the buffered reader that read the log file. I had to setup and debug the timestamper plug-in source to understand this. Can some one update the documentation?

    Thanks

    1. Hi Dinesh,

      I'm not sure I understand. Is the BufferedReader empty unless you use the appendLog flag? Could you raise a JIRA with more details?