You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In log4j 2.x docs, there's a lot of other ansi style currently Spring Boot doesn't support using %clr:
bold
underline
reverse (swaps the background and foreground colors)
bg_* colors (background colors)
multiple style (e.g. {%bold %red})
custom colors (specified with hex code)
Currently, AnsiStyle have bold and underline, and all bg named colors have the same names of already implemented foreground colors.
reverse is particularly interesting IMO used with log levels.
AFAIK, of these styles, logback supports only bold foreground colors.
log4j also allows normal, hidden and blink. I fail to see the usefulness of the first two, while I don't like blink at all. Just adding them for the sake of completeness.
I'm interested in working on this if the team decides to move forward with it. Would you prefer a PR that covers both Logback and Log4j2, or should they be handled separately?
@mayankvirole Thanks. I think covering both in a single PR would be fine. We might split it up when we come to merge it.
I did have a brief look at the code yesterday and concluded we'll probably need updates to the converters so that multiple parameters can be passed to the converter. Currently you can only specify one, which gets converted into a single AnsiElement. I think we'll need to support several so that you can set forground/background/style in one hit. We'd then need to add more items to the ELEMENTS map to cover AnsiStyle, AnsiBackground and AnsiColor.
The reverse feature doesn't currently exist, and it might be better to take that on at a later time.
changed the title [-]Feauture request: Add other ansi styles to log4j (and logback?)[/-][+]Add more ansi styles to the logging system[/+]on Feb 20, 2026
Activity
mayankvirole commentedon Feb 19, 2026
I'm interested in working on this if the team decides to move forward with it. Would you prefer a PR that covers both Logback and Log4j2, or should they be handled separately?
philwebb commentedon Feb 19, 2026
@mayankvirole Thanks. I think covering both in a single PR would be fine. We might split it up when we come to merge it.
I did have a brief look at the code yesterday and concluded we'll probably need updates to the converters so that multiple parameters can be passed to the converter. Currently you can only specify one, which gets converted into a single
AnsiElement. I think we'll need to support several so that you can set forground/background/style in one hit. We'd then need to add more items to theELEMENTSmap to coverAnsiStyle,AnsiBackgroundandAnsiColor.The
reversefeature doesn't currently exist, and it might be better to take that on at a later time.[-]Feauture request: Add other ansi styles to log4j (and logback?)[/-][+]Add more ansi styles to the logging system[/+]Add more ANSI styles to the logging color converter
wilkinsona commentedon Mar 11, 2026
Closing in favor of #49285.