title: Log4j2: How to use replace parameter in log4j2.properties file
body: <p>Using log4j2, I want to replace some strings in log message (say replace <em><strong>foo</strong></em> with <em><strong>bar</strong></em>). In xml configuration, I can use the following configuration and it works.</p>
  <pre><code>&lt;Appenders&gt;
       &lt;Console name=&quot;A1&quot; target=&quot;SYSTEM_OUT&quot;&gt;
           &lt;PatternLayout pattern=&quot;[%d{HH:mm:ss}] %m%n&quot;&gt;
               &lt;replace regex = &quot;foo&quot; replacement=&quot;bar&quot;/&gt;
           &lt;/PatternLayout&gt;
       &lt;/Console&gt;
  &lt;/Appenders&gt;
  </code></pre>
  <p>But insted of using XML, I have to use properties file in my project, so I tried something like</p>
  <pre><code>appender.A1.type = Console
  appender.A1.name = A1
  appender.A1.layout.type = PatternLayout
  appender.A1.layout.pattern = [%d{HH:mm:ss}] %m%n
  # Probably BAD code begin
  appender.A1.layout.replace.regex = foo
  appender.A1.layout.replace.replacement = bar
  # Probably BAD code end
  </code></pre>
  <p>And I got error like:</p>
  <pre><code>Exception in thread &quot;main&quot; org.apache.logging.log4j.core.config.ConfigurationException: No type attribute provided for component replace
      at org.apache.logging.log4j.core.config.properties.PropertiesConfigurationBuilder.createComponent(PropertiesConfigurationBuilder.java:334)
  ...
  </code></pre>
  <p>How can I represent <em><strong>replace</strong></em> in properties file and in log4j2, is it possible to transform everything in xml configuration to properties configuration?
  I'm using log4j-api-2.14.0.jar and log4j-core-2.14.0.jar.</p>
  <p>Thx in advance!</p>
  <p><strong>EDIT:</strong>
  I 've also tried <code>replace{pattern}{regex}{substitution}</code> before. And I think this is different from the <strong>replace</strong> parameter.
  Say the pattern is</p>
  <pre><code>appender.A1.layout.pattern = [%d{HH:mm:ss}][%C::%M] %replace{%m}{foo}{bar}%n
  </code></pre>
  <p>And I will get</p>
  <pre><code>[09:28:07][com.foo.MyApp::main] 111 bar 222
  </code></pre>
  <p>but what I want to get is</p>
  <pre><code>[09:28:07][com.bar.MyApp::main] 111 bar 222
  </code></pre>
  <p>Using above XML configuration, I can get the correct result but I don't know how to convert it into properties configuration.</p>