Console output and stack trace to be in bold letters

is it possible to make the error message to be visible on bold letters on console output and stacktrace?

Hello and welcome to this community, @Nandhakumaaran. :wave:

For messages sent by plugins or Jenkins core, you typically do not have control over their appearance, including making them bold.
The appearance of these messages is managed by the Jenkins core and the respective plugins, and they do not usually support custom formatting like ANSI escape codes.

If you need to highlight or emphasize certain messages, you might consider logging your own messages with the desired formatting in your scripts or custom plugins. However, for built-in messages and those from third-party plugins, you will be limited to the default formatting provided by Jenkins.

I think that the Log Parser plugin provides some ability to change the formatting of build log messages. I don’t use it, but the plugin documentation hints that it might work if @Nandhakumaaran is willing to define regular expressions that match the error messages.

1 Like

Nice find, I didn’t know that. :ok_hand:

One gotcha with the log parser plugin is that it has to run regex matches on the console output. It is fine if you have small console outputs but if you have a pipeline that generates very large logs you will slow down the controller and possibly crash it. I generally recommend to try to keep your console output well under 2MB, but I’ve seen console outputs balloon to over 10GB and the Log Parser Plugin will definitely struggle with that.

I used to install the plugin but have stopped due to the overhead on the controller. If there was a way to enforce a console output size limit that would be good but the only plugin that is supposed to help with limiting the output does not work (it silently does nothing).

Alternatively you could add terminal color code in your output if you control your error messages and stack trace. It will add escape characters to your raw console output but jenkins should respect these.

For example we have integration test pipelines that run with pytest and the errors are colored automatically.

There is an other thing you can try which is to generate junit test reports. The idea is that if you control the code that would generate the errors, you could have these errors and stack traces written as a test report and use the junit report plugin to parse these results at the end of the pipeline. You will then get a very clean report with the list of errors and the stack traces alongside them. Things like pytest can generate these for you easily, but you could generate your own files.

While the naming implies this is for unittests, you can use it to collect and present any sort of failures/errors you like.

2 Likes