Log4j2 not able to apply pattern layout %replace feature more than 2 times in sequence

1.3k views Asked by At
%replace{%replace{%replace{%msg}{regex1}{substitution1}}{regex2}{substitution2}}{regex3}{substitution3}

I'm trying to replace the regex pattern from my log and it works properly.
When %replace is used at max twice, but when I try to replace the third pattern it stops working and it just prints "%replace " in log output.

1

There are 1 answers

0
incognito nerd On

this works for me.

<Pattern>"%d{yyyy-MM-dd HH:mm:ss} - %replace{%replace{%replace{%msg}{reg1}{sub1}}{reg2}{sub2}}{reg3}{sub3}%n"</Pattern>