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

ANSIColor plugin leaks format onto next line's timestamp

    XMLWordPrintable

Details

    Description

      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.

      Attachments

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

        Issue Links

          Activity

            stevengbrown 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' '
            
            stevengbrown 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_issue_link 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.

            stevengbrown 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

            dankirkd 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 }
            
            borgstrom 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?

            dankirkd 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.

            borgstrom 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

            dankirkd 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_issue_link 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.
            stevengbrown 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...

            simonwydooghe 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.

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

            PR 132 may be a good starting point.

            jglick Jesse Glick added a comment - PR 132 may be a good starting point.
            dnusbaum 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.

            dnusbaum 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.
            jglick 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.

            jglick 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.

            docwhat 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.
            jglick Jesse Glick added a comment -

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

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

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

            dnusbaum Devin Nusbaum added a comment - And if PR 137 doesn't help, it would be worth checking if  PR 147 makes a difference.
            nmanos 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

            nmanos 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

            People

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

              Dates

                Created:
                Updated: