Skip to content

Add more ansi styles to the logging system #49262

Closed

Description

@Marco-Sulla

In log4j 2.x docs, there's a lot of other ansi style currently Spring Boot doesn't support using %clr:

  1. bold
  2. underline
  3. reverse (swaps the background and foreground colors)
  4. bg_* colors (background colors)
  5. multiple style (e.g. {%bold %red})
  6. 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.

Activity

  1. added
    status: waiting-for-triage
    on Feb 18, 2026
  2. added
    type: enhancement
    and removed
    status: waiting-for-triage
    on Feb 18, 2026
  3. added this to the General Backlog milestone on Feb 18, 2026
  4. mayankvirole commented on Feb 19, 2026

    @mayankvirole
    Contributor

    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?

  5. philwebb commented on Feb 19, 2026

    @philwebb
    Member

    @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.

  6. 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
  7. added a commit that references this issue on Mar 10, 2026
    1530e30
  8. wilkinsona commented on Mar 11, 2026

    @wilkinsona
    Member

    Closing in favor of #49285.

  9. removed this from the General Backlog milestone on Mar 11, 2026
  10. added
    status: superseded
    on Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

status: supersededtype: enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions