【问题标题】:Log4j2 not able to apply pattern layout %replace feature more than 2 times in sequenceLog4j2 无法按顺序应用模式布局 %replace 功能超过 2 次
【发布时间】:2018-05-21 10:02:13
【问题描述】:
%replace{%replace{%replace{%msg}{regex1}{substitution1}}{regex2}{substitution2}}{regex3}{substitution3}

我正在尝试从我的日志中替换正则表达式模式并且它可以正常工作。
%replace 最多使用两次,但是当我尝试替换第三个模式时它停止工作,它只是在日志输出中打印“%replace”。

【问题讨论】:

    标签: regex slf4j log4j2 pattern-layout


    【解决方案1】:

    这对我有用。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-18
      • 2021-08-19
      • 1970-01-01
      • 2011-08-17
      • 1970-01-01
      相关资源
      最近更新 更多