ramanathan1504 opened a new issue, #4254: URL: https://github.com/apache/logging-log4j2/issues/4254
`%xEx{ansi(Style=Spock)}` and `%xEx{ansi(Style=Kirk)}` render with no
styling at all.
Two defects in `JAnsiTextRenderer`:
1. `JAnsiTextRenderer.java:217` — the predefined map is merged with
`map.putAll(predefinedMap)`,
which keeps its keys as written (`Name`, `Message`, …), but lookup at
line 247 is
`styleMap.get(toRootUpperCase(styleName))`, so nothing ever matches.
The name falls through to
`AnsiEscape.createSequence("Name")`, which warns and returns an empty
`ESC[m`.
2. `JAnsiTextRenderer.java:97-101` — `entry()` builds `CSI + code + code`
with no `;` separator
and no `m` suffix, so `entry("Name", BG_RED, WHITE)` yields `ESC[4137`.
`merge()` at line 263
then strips a trailing `m` that was never appended. Masked today by
(1).
Reproduced against `2.x` HEAD, `new JAnsiTextRenderer(new String[]
{"ansi", "Style=Spock"}, emptyMap())`:
Name -> ESC[m XYZ ESC[m
Name,Message -> ESC[;m XYZ ESC[m
bg_red,white -> ESC[41;37m XYZ ESC[m (user-supplied styles are
fine)
`main` has both defects in the renamed `AnsiTextRenderer` (lines 192,
96-99, 238).
Found while reviewing #4184; unrelated to that PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
