# timestamper-plugin **Repository Path**: mamh-java/timestamper-plugin ## Basic Information - **Project Name**: timestamper-plugin - **Description**: https://github.com/mamh-java/timestamper-plugin - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-14 - **Last Updated**: 2026-06-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README = Timestamper Plugin :toc: :toc-placement!: :toc-title: ifdef::env-github[] :tip-caption: :bulb: :note-caption: :information_source: :important-caption: :heavy_exclamation_mark: :caution-caption: :fire: :warning-caption: :warning: endif::[] toc::[] == Introduction The Timestamper plugin adds timestamps to the console output of Jenkins jobs. For example: .... 21:51:15 Started by user anonymous 21:51:15 Building on my-jenkins-agent 21:51:17 Finished: SUCCESS .... == Getting started === Freestyle jobs Enable timestamps within the *Build Environment* section of the build's configuration page. To enable timestamps for multiple builds at once, use the https://plugins.jenkins.io/configurationslicing/[Configuration Slicing plugin] version 1.32 or later. === Pipeline jobs Set the global option to enable timestamps for all https://jenkins.io/doc/book/pipeline/[Pipeline] builds (in *Manage Jenkins*, *Configure System*), or use the `timestamps` step as described below. image:docs/images/allBuilds.png[image] Use the `timestamps` step to wrap the rest of the Pipeline script. [source,groovy] ---- timestamps { // some block } ---- == Customization * The timestamp format can be configured via the *Manage Jenkins*, *Configure System* page or through the link:https://plugins.jenkins.io/configuration-as-code/[configuration as code plugin] * 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 https://www.jenkins.io/doc/book/using/change-time-zone/[a system property]. == Configuration as Code The link:https://plugins.jenkins.io/configuration-as-code/[configuration as code plugin] can configure the Timestamper plugin automatically. When `allPipelines` is true, timestamps are enabled for all Pipeline builds. Individual Pipelines do not need to use the `timestamps` step or the `timestamps` option. Elapsed time string formatting is controlled by a format string as defined in the link:https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DurationFormatUtils.html[Apache Commons Lang DurationFormatUtils]. System time string formatting is controlled by a format string as defined in link:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/text/SimpleDateFormat.html[Java SimpleDateFormat]. [source,yaml] ---- unclassified: timestamper: allPipelines: true elapsedTimeFormat: "''HH:mm:ss.S' '" systemTimeFormat: "''HH:mm:ss' '" ---- == Scripting Scripts can read the timestamps from the `/timestamps/` URL of each build. For example: `/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 controller. Supported query parameters: `time`:: Display the system clock time. Accepts the https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/text/SimpleDateFormat.html[JDK `SimpleDateFormat`] format. + NOTE: The time zone and locale of the Jenkins controller will be used, unless they are configured with the `timeZone` and `locale` query parameters. `elapsed`:: Display the elapsed time since the start of the build. Accepts the https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/time/DurationFormatUtils.html[Commons Lang `DurationFormatUtils`] format. `precision`:: 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`:: Display the console log line after the timestamp. `startLine`:: 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`:: 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`:: Time zone used when displaying the system clock time. Accepts the https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/TimeZone.html[JDK `TimeZone`] ID format. `locale`:: Select the locale to use when displaying the system clock time. Accepts a locale in the format recognized by https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/LocaleUtils.html#toLocale-java.lang.String-[Commons Lang `LocaleUtils#toLocale`]. `currentTime`:: Display the current time on the Jenkins controller instead of reading timestamps from the build. CAUTION: Reading the timestamps directly from the file system is not recommended, because the format may change. === Java API Other plugins can add a https://www.jenkins.io/doc/developer/plugin-development/dependencies-and-class-loading/#depending-on-other-plugins[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. For example: [source,java] ---- import hudson.plugins.timestamper.api.TimestamperAPI; import java.io.BufferedReader; String query = "time=HH:mm:ss"; try (BufferedReader reader = TimestamperAPI.get().read(build, query)) { // read timestamps here } ---- == Issues Report issues and enhancements in https://github.com/jenkinsci/timestamper-plugin/issues/new/choose[GitHub]. == Changelog in https://github.com/jenkinsci/timestamper-plugin/releases[GitHub Releases] Release notes have been recorded in https://github.com/jenkinsci/timestamper-plugin/releases[GitHub] since Timestamper plugin 1.10. Release notes for releases before 1.10 are recorded in the plugin repository link:https://github.com/jenkinsci/timestamper-plugin/blob/timestamper-1.30/CHANGELOG.adoc[change log]. == Contributing Refer to our https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md[contribution guidelines]. == License Licensed under link:LICENSE[the MIT License].