Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-49262

Timestamps are not added to module logs in Maven jobs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: In Review (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: maven-plugin
    • Labels:
      None
    • Environment:
      Fedora 25 x86_64, Java 1.8.0_112, Jenkins 2.89.3 (from RPM), SSH slaves, Maven Plugin 3.1, Timestamper 1.8.9
    • Similar Issues:

      Description

      "Build Environment » Add timestamps to the Console Output" doesn't have any effect on the console output in a Maven-based project. (They are added to freestyle projects; I don't have any other types.) It appears to be possible to add them with a pipeline (JENKINS-30142) but I'd prefer the config option to work.

        Attachments

          Activity

          Hide
          stevengbrown Steven G Brown added a comment -

          Hi Peter,

          I'm sorry you've run into difficulties. I gave it a go myself, with the same versions of Jenkins, Maven Plugin and Timestamper, and it worked for me. Could you check a few things to help me track down the problem?

          On the Jenkins master, open the directory for the build. You should see a build.xml, log and also a timestamper directory containing the timestamps. If not, it means that the timestamps weren't recorded.

          You should see this on the left hand side of the page. Make sure you have "System clock time" or "Elapsed time" selected and not "None". While you have this page open, please also check the browser console for warnings.

          Cheers
          Steve

          Show
          stevengbrown Steven G Brown added a comment - Hi Peter, I'm sorry you've run into difficulties. I gave it a go myself, with the same versions of Jenkins, Maven Plugin and Timestamper, and it worked for me. Could you check a few things to help me track down the problem? On the Jenkins master, open the directory for the build. You should see a build.xml , log and also a timestamper directory containing the timestamps. If not, it means that the timestamps weren't recorded. You should see this on the left hand side of the page. Make sure you have "System clock time" or "Elapsed time" selected and not "None". While you have this page open, please also check the browser console for warnings. Cheers Steve
          Hide
          peterj Peter Janes added a comment -

          I do see a timestamper directory, with a 32-byte timestamps file and a 41-byte timestamps.SHA-1 file. However, in the console output for the job I don't have a `Timestamps` block. Not sure what's up.

          Show
          peterj Peter Janes added a comment - I do see a timestamper directory, with a 32-byte timestamps file and a 41-byte timestamps.SHA-1 file. However, in the console output for the job I don't have a `Timestamps` block. Not sure what's up.
          Hide
          peterj Peter Janes added a comment -

          Oh! I see the issue: the job is configured to build modules in parallel, and it's the module logs that don't have timestamps. The parent build does have the `Timestamps` config block, and I see timestamps in the output, but they show that the build (of the parent) is "complete" in just a few seconds, even though the child jobs take much longer to run.

          10:26:35 Started by user Peter Janes
          10:26:35 [EnvInject] - Loading node environment variables.
          10:26:35 Building remotely on build14 (x86_64 fedora25) in workspace /home/jenkins/workspace/test-project
          ...
          10:26:42 Triggering test:test
          10:26:42 Sending e-mails to: [my email]
          10:26:42 Finished: SUCCESS
          
          Show
          peterj Peter Janes added a comment - Oh! I see the issue: the job is configured to build modules in parallel, and it's the module logs that don't have timestamps. The parent build does have the `Timestamps` config block, and I see timestamps in the output, but they show that the build (of the parent) is "complete" in just a few seconds, even though the child jobs take much longer to run. 10:26:35 Started by user Peter Janes 10:26:35 [EnvInject] - Loading node environment variables. 10:26:35 Building remotely on build14 (x86_64 fedora25) in workspace /home/jenkins/workspace/test-project ... 10:26:42 Triggering test:test 10:26:42 Sending e-mails to: [my email] 10:26:42 Finished: SUCCESS
          Hide
          stevengbrown Steven G Brown added a comment -

          Thanks for investigating further Peter Janes. I was able to reproduce it too by using the parallel builds.

          I've submitted a fix for the Maven plugin.
          https://github.com/jenkinsci/maven-plugin/pull/114

          Show
          stevengbrown Steven G Brown added a comment - Thanks for investigating further Peter Janes . I was able to reproduce it too by using the parallel builds. I've submitted a fix for the Maven plugin. https://github.com/jenkinsci/maven-plugin/pull/114
          Hide
          jayram Jayakumari A added a comment - - edited

          I am using Jenkins to automate our build and release process.

          While executing a job under Jenkins, timestamp is not shown in the console build log.

          To add timestamp to console build log, I have downladed "Timestamper" plugin and enabled "Add timestamps to the Console Output" option in each of my jobs' configurations under Jenkins. Now the timestamp is appened to the console build log in Jenkins.

          But when I checked the same build log file in the "jobs" folder under Jenkins home directory, the timestamp in not appeneded in the log file.

          As this log file is attached with job build details while sending mail to stakeholders, it is inevitable to add timestamp in the log file.

          Please check the below contents.

          In Console Build Log
           {{15:40:04 Started by user TEST
          15:40:04 [EnvInject] - Loading node environment variables.
          15:40:04 Building in workspace C:\jenkins\workspace
          15:40:04 No emails were triggered.}}

          In Actual Log File
           {{Started by user TEST
          [EnvInject] - Loading node environment variables.
          Building in workspace C:\jenkins\workspace
          No emails were triggered.}}

          So, I have two questions{{}} # How to enable "Add timestamps to the Console Output" option as one time process to all Jobs as I have more jobs in Jenkins?

          1. How to add timestamp to the actual build log file under "jobs" folder under Jenkins home directory?

          Thanks in advance.

          Show
          jayram Jayakumari A added a comment - - edited I am using Jenkins to automate our build and release process. While executing a job under Jenkins, timestamp is not shown in the console build log. To add timestamp to console build log, I have downladed "Timestamper" plugin and enabled "Add timestamps to the Console Output" option in each of my jobs' configurations under Jenkins. Now the timestamp is appened to the console build log in Jenkins. But when I checked the same build log file in the "jobs" folder under Jenkins home directory, the timestamp in not appeneded in the log file. As this log file is attached with job build details while sending mail to stakeholders, it is inevitable to add timestamp in the log file. Please check the below contents. In Console Build Log  {{15:40:04 Started by user TEST 15:40:04 [EnvInject] - Loading node environment variables. 15:40:04 Building in workspace C:\jenkins\workspace 15:40:04 No emails were triggered.}} In Actual Log File  {{Started by user TEST [EnvInject] - Loading node environment variables. Building in workspace C:\jenkins\workspace No emails were triggered.}} So, I have two questions{{}} # How to enable "Add timestamps to the Console Output" option as one time process to all Jobs as I have more jobs in Jenkins? How to add timestamp to the actual build log file under "jobs" folder under Jenkins home directory? Thanks in advance.

            People

            • Assignee:
              stevengbrown Steven G Brown
              Reporter:
              peterj Peter Janes
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: