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

ANSIColor plugin leaks format onto next line's timestamp

      When used with timestamped console output, the formatting from one line sometimes (but not always) leaks over and colors the timestamp on the next line.

        1. with.png
          with.png
          8 kB
        2. without.png
          without.png
          6 kB
        3. consolelog.png
          consolelog.png
          323 kB

          [JENKINS-34019] ANSIColor plugin leaks format onto next line's timestamp

          Steven G Brown added a comment - - edited

          Shell script that I used to reproduce this issue:

          #!/bin/sh
          
          # Foreground
          echo "\033[31mRed Foreground"
          echo "\033[0mOff"
          # Background
          echo "\033[46mCyan Background"
          echo "\033[0mOff"
          # Bold
          echo "\033[1mBold"
          echo "\033[0mOff"
          # Underline
          echo "\033[4mUnderline"
          echo "\033[0mOff"
          # Double-underline
          echo "\033[21mDouble-underline"
          echo "\033[0mOff"
          

          Also changed System clock time format so that it no longer uses bold text:

          HH:mm:ss' '
          

          Steven G Brown added a comment - - edited Shell script that I used to reproduce this issue: #!/bin/sh # Foreground echo "\033[31mRed Foreground" echo "\033[0mOff" # Background echo "\033[46mCyan Background" echo "\033[0mOff" # Bold echo "\033[1mBold" echo "\033[0mOff" # Underline echo "\033[4mUnderline" echo "\033[0mOff" # Double-underline echo "\033[21mDouble-underline" echo "\033[0mOff" Also changed System clock time format so that it no longer uses bold text: HH:mm:ss' '

          Code changed in jenkins
          User: Steven Brown
          Path:
          src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java
          src/main/webapp/style.css
          http://jenkins-ci.org/commit/timestamper-plugin/c31dc9571d5d1121d3f7e43d81059e0818e58b7a
          Log:
          JENKINS-34019 When displaying timestamps, ignore AnsiColor plugin styling

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Brown Path: src/main/java/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2.java src/main/webapp/style.css http://jenkins-ci.org/commit/timestamper-plugin/c31dc9571d5d1121d3f7e43d81059e0818e58b7a Log: JENKINS-34019 When displaying timestamps, ignore AnsiColor plugin styling

          Fix released with Timestamper 1.8.6.

          Steven G Brown added a comment - Fix released with Timestamper 1.8.6.

          Is there a way to adjust the colors? I'm not sure I like the new .timestamp style.

          It turns the unassuming

          into the jarring

          Daniel Kirkdorffer added a comment - Is there a way to adjust the colors? I'm not sure I like the new .timestamp style. It turns the unassuming into the jarring

          dankirkd – See my comment here: https://github.com/jenkinsci/timestamper-plugin/commit/c31dc9571d5d1121d3f7e43d81059e0818e58b7a#commitcomment-19199648

          In the mean time I worked around this locally for myself by adding to following to my local CSS for Jenkins.

          span.timestamp { background: inherit }
          

          Evan Borgstrom added a comment - dankirkd – See my comment here: https://github.com/jenkinsci/timestamper-plugin/commit/c31dc9571d5d1121d3f7e43d81059e0818e58b7a#commitcomment-19199648 In the mean time I worked around this locally for myself by adding to following to my local CSS for Jenkins. span.timestamp { background: inherit }

          borgstrom, how does one make that adjustment to Jenkins via the UI?

          Daniel Kirkdorffer added a comment - borgstrom , how does one make that adjustment to Jenkins via the UI?

          dankirkd We use the jenkins material theme and ship our own CSS, so I just stuck it in there. I'm not sure how you'd apply that value.

          Evan Borgstrom added a comment - dankirkd We use the jenkins material theme and ship our own CSS, so I just stuck it in there. I'm not sure how you'd apply that value.

          I've created a new bug: JENKINS-38573

          Daniel Kirkdorffer added a comment - I've created a new bug: JENKINS-38573

          Code changed in jenkins
          User: Steven Brown
          Path:
          src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/style.css
          http://jenkins-ci.org/commit/timestamper-plugin/6b763a9b72afa21d7f3fe3a8e850612029bac335
          Log:
          JENKINS-38390 JENKINS-34019 Revert timestamps style added by c31dc95

          The style matched the default Jenkins theme, but clashed with custom themes.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Steven Brown Path: src/main/resources/hudson/plugins/timestamper/annotator/TimestampAnnotatorFactory2/style.css http://jenkins-ci.org/commit/timestamper-plugin/6b763a9b72afa21d7f3fe3a8e850612029bac335 Log: JENKINS-38390 JENKINS-34019 Revert timestamps style added by c31dc95 The style matched the default Jenkins theme, but clashed with custom themes.

          Changes were reverted for Timestamper 1.8.7. Overriding the style works fine for the default Jenkins theme, but clashes with custom themes.

          This can be fixed instead within the AnsiColor plugin by:

          1. Using a ConsoleAnnotatorFactory instead of inserting console notes into the log file.
          2. When a style continues to the next line, the ConsoleAnnotatorFactory can insert a closing tag at the end of the line and an opening tag at the beginning of the next line. This prevents the timestamps from being affected.

          Steven G Brown added a comment - Changes were reverted for Timestamper 1.8.7. Overriding the style works fine for the default Jenkins theme, but clashes with custom themes. This can be fixed instead within the AnsiColor plugin by: Using a ConsoleAnnotatorFactory instead of inserting console notes into the log file. When a style continues to the next line, the ConsoleAnnotatorFactory can insert a closing tag at the end of the line and an opening tag at the beginning of the next line. This prevents the timestamps from being affected.

          Would be nice to see this fixed if possible...

          Simon Wydooghe added a comment - Would be nice to see this fixed if possible...

          I have provided instructions to reproduce and fix. Pull requests welcome.

          Steven G Brown added a comment - I have provided instructions to reproduce and fix. Pull requests welcome.

          Jesse Glick added a comment -

          PR 132 may be a good starting point.

          Jesse Glick added a comment - PR 132 may be a good starting point.

          Devin Nusbaum added a comment -

          PR 132 may be a good starting point.

          PR 132 was just released in Ansicolor 0.6.0, so it would be good if someone who is seeing this issue can confirm whether that version improves the situation.

          Devin Nusbaum added a comment - PR 132 may be a good starting point. PR 132 was just released in Ansicolor 0.6.0, so it would be good if someone who is seeing this issue can confirm whether that version improves the situation.

          Jesse Glick added a comment -

          IIUC it was more that switching to a console annotator was expected to make it easier to fix this, as outlined in the note of 2016-10-04.

          Jesse Glick added a comment - IIUC it was more that switching to a console annotator was expected to make it easier to fix this, as outlined in the note of 2016-10-04.

          We have an issue where [0m (aka setaf 0) is being printed to the screen at the end of a line with color and timestamps. This messes up the color for all future lines, though the timestamps themselves are okay.

          Christian Höltje added a comment - We have an issue where [0m (aka setaf 0 ) is being printed to the screen at the end of a line with color and timestamps. This messes up the color for all future lines, though the timestamps themselves are okay.

          Jesse Glick added a comment -

          Recheck after PR 137 (unreleased as of this writing).

          Jesse Glick added a comment - Recheck after PR 137 (unreleased as of this writing).

          Devin Nusbaum added a comment -

          And if PR 137 doesn't help, it would be worth checking if PR 147 makes a difference.

          Devin Nusbaum added a comment - And if PR 137 doesn't help, it would be worth checking if  PR 147 makes a difference.

          Noam Manos added a comment -

          As a workaround, when the timestamper background is white, while the console was set to black in Ansi-Color plugin,

          you can use  https://github.com/jazzzz/jenkins-black-console to configure the default CSS to black.

           

          All you need is to install Simple Theme Plugin and configure in "Manage Jenkins" this theme:

          https://jazzzz.github.io/jenkins-black-console/black-console.css

          Noam Manos added a comment - As a workaround, when the timestamper background is white, while the console was set to black in Ansi-Color plugin, you can use   https://github.com/jazzzz/jenkins-black-console to configure the default CSS to black.   All you need is to install  Simple Theme Plugin and configure in "Manage Jenkins" this theme: https://jazzzz.github.io/jenkins-black-console/black-console.css

            Unassigned Unassigned
            evildeece Alastair D'Silva
            Votes:
            5 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: