I have installed the ANSI-color plugin for Jenkins. In the Jobs I have activated that plugin with the default profile 'xterm'.
I cannot figure out how to colorize the output of the Console Log when printing to the log from the batch files (Windows-platform).
The documentation on
https://wiki.jenkins-ci.org/display/JENKINS/AnsiColor+Plugin
is not helpful. There are no examples how to actually print in color.
I tried several different echo/print commands, but I cannot get colors to work.
Any hint appreciated.
Jenkins ANSI Color PluginThis plugin adds support for standard ANSI escape sequences, including color, to Console Output. This plugin is available here and has a page on the Jenkins Wiki.
In order to read the console output in Jenkins, All you need to do is copy and paste the code as a stage in your pipeline script. After the build is run, a file named buildConsolelog. txt will be stored in the home directory of your project.
The ANSI-color plug in transforms your console output to HTML. If your output contains ansi escape sequences, then it converts these special char sequences into (colored) HTML. You can only configure the mapping via 'ANSI color map'.
Example:
\x1b[31m is transformes html color red
It looks that your program does't use Escape sequences. But if you wrote your own software or script, you can use these Escape sequences.
1st Example BASH:
echo -e "\033[31mRed\033[0m"
2nd Example BASH:
printf "\033[31mRed\033[0m"
If you need it, you have to add a newline sequence to printf:
printf "\033[31mRed\033[0m\n"
More to Escape sequences:
English: http://en.wikipedia.org/wiki/ANSI_escape_code
Deutsch: http://de.wikipedia.org/wiki/Escape-Sequenz
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With