Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Log Colors on IntelliJ Run Console

Having problems to see the colors for logs on the IntelliJ Run Console (windows).

Through Cygwin run, I see logs have different colors, e.g: enter image description here

On the IntelliJ run Console, same logs show without any colors: enter image description here

like image 347
Al-Punk Avatar asked Oct 10 '18 10:10

Al-Punk


People also ask

How do I print in color in console log?

For the terminal, we can use %s and \x1b to print colored logs. Notice the %s in the first argument string. This is where the second argument (the string we want to print) will be injected. The first half of the string (before the %s ) is: \x1b[33m .

How do I use console log in IntelliJ?

Add a log In the run/debug configuration that will be used for launching the app, click Modify options. From the menu, select Specify logs to be shown in console. In the table that opens, click Add. Specify the log Alias (the name that will be displayed in the tool window tabs) and the path to the log file.


1 Answers

The GrepConsole plugin for IntelliJ supports something like this.

Here's some console output with no use of GrepConsole:

enter image description here

And here's the same console output again but with GrepConsole configured to render lines containing INFO in green and lines containing ERROR in red:

enter image description here

Here's the GrepConsole configuration:

enter image description here

Note: this does not exactly match what you asked for (highlighting a single word) but it's close and configuring GrepConsole for this behavour is very simple and GrepConsole also offers other useful features such a searching and filtering the console output.

like image 110
glytching Avatar answered Oct 22 '22 08:10

glytching