Change the Color of Log Text

I’m trying to easily see my own log messages in the output log when I run my game. While the category helps it would be much better if I could visually instantly see my logs via a color. Now I know you can use Warning or Error as the Verbosity but while hunting through the code I spotted that the Verbosity has a value of SetColor… I just have no idea how to use it, I spent a good few hours diving through code but got lost :slight_smile:

Basically I’d like to set it to a color so that my logs stand out against any real warnings, errors, or system logs that are automatically generated.

I posted this on answer hub but recieved no aid, so If you have an idea please post it below and/or on the answer hub topic

I replied to the answers post in the hope you’ll give me kudos :wink:

Hi GeekyPayback,

Most defiantly :smiley: will, I try to be diligent about giving kudos

The red error text is well nigh impossible to read on the grey background, i’d love to know how to change that at the very least as well.

Well GeekyPayback stated in the answer hub that to change the Warn color you can use a macro called

SET_WARN_COLOR(COLOR_CYAN)

I assume there is a similar color such as

SET_ERROR_COLOR()

and

SET_LOG_COLOR()

Unfortunately I cannot test those assumptions at the moment. I do have a question about if that sets the Warn color for ALL warnings or just the warnings logged since you changed the color. I would really love a method to set color by category rather than the entire warning or error verbosity. Or maybe a way to define your own verbosity (though by verbosity doesn’t make much since, by line or category would be ideal).

I think set warn colour actually only works when you use the log parameter, second one in on the example below (rather than warn or error)



UE_LOG( LogYourCategory, Log, TEXT("%s%s() : %s"), NETMODE_WORLD, FUNC_NAME, *Msg);\


My suspicion is that warn and error have their own overrides.

You have to use CLEAR_WARN_COLOR afterwards to go back to how it was. As I said on the answers page, there’s a wiki about custom log files here

I recently tried to implement this in my own project following your example, but was unable to get a color for the log produced when running an executable with -log, or in the output log of the editor. Has this method stopped working all around? Did it ever work?

It won’t change the colour of a text file, but should change the colour of the text in the log window. Paste up your code and let’s have a look

I was being impatient and wanted to reduce compile time, so I had placed the macro defines in a .cpp file. The code was lifted directly from the wiki, which did nothing to lead me to believe it would work if pasted into a .cpp file… so totally my bad. I have since placed it in the project header and it functions as intended.
Perhaps this can serve as a warning to others as impatient as myself. Thanks so much for the snippet, its gonna be super helpful.

Hmm, has this changed in 4.23? I’m not seeing the color in the log.

Can anybody confirm if this is working ? Couldn’t make it work :frowning:

Sadly I have never gotten this to work and have resigned myself to simply using the white, yellow, and red indicators for logs

I did some testing. It doesn’t appear to work in 4.24.

  1. Code is in the header file. #include “Misc/OutputDevice.h” as well (which also contains instructions on use)
  2. Building colour table in the format: RGBB, e.g. bright red: 1001, dark red: 1000
  3. Also just tried COLOR_PURPLE (and again with the namespace, fetches the colour code fine in both cases)
  4. Tried both SET_WARN_COLOR(COLOR_PURPLE) and its actual command: UE_LOG(LogTemp, SetColor, TEXT("%s"), COLOR_PURPLE); (original logspace isn’t LogTemp though, it’s LogHAL)
  5. Tried Log, Warning and Error log channels

Nothing. Bit annoyed, like you guys I can’t read red on grey, and it would have been nice to be able to print to the log in a similar way that we can print colour strings to the HUD.

I hope this gets fixed.

I started using cygwin and multitail to achieve colored logs. It takes a bit more doing because you have to regex to get the coloring you want, but you get exactly what you want.

This is the multitail ue4 colorscheme I have so far: (drop this in /etc/multitail.conf)



colorscheme:ue4
# Pickout Specials Words etc.
cs_re:87:LogAbilitySystem
cs_re:99:Task
cs_re:99:Ability
cs_re:9:Fatal
cs_re:9:Error
cs_re:3:Warning
cs_re:11:Display
cs_re:82:Verbose
cs_re:81:VeryVerbose

# General Color Formatting
cs_re:2:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]
cs_re_s:3:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*](\...*\])
cs_re_s:4:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]\...*\](^ ]*)
cs_re_s:6:^\[0-9]*.[0-9]*.[0-9]*-[0-9]*.[0-9]*.[0-9]*:[0-9]*]\...*\]^ ]*(.*)


Also, check out this link for setting up a nice shell (no affiliation with this person, just found it and sharing)
https://www.trueneutral.eu/2014/win-proper-term.html

Output of command:


multitail.exe -cS ue4 <your logfile>.log

Bonus Links:

To those still looking, Enhanced Output Log on the marketplace is targeted at this issue

1 Like