title: Math operations inside log4j2.xml
body: <p>I want to add a custom pattern inside <code>log4j2.xml</code>.
  In there I need to do some math operations like <code>multiplication (*)</code>, <code>modulo(%)</code>  of the log output.</p>
  <p>For an example, assume I'm getting the Unix time in seconds as the log output. If I need to <code>multiply it by 1000</code>, how should I do it?</p>
  <p>I tried out different ways of doing that. But it outputs the math operations as plain text.</p>
  <p>Here is the example pattern I used in <code>log4j2.xml</code>. I tried out different ways of multiplications in there.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;Console name=&quot;stdout&quot; target=&quot;SYSTEM_OUT&quot;&gt;
      &lt;PatternLayout&gt;
          &lt;pattern&gt;%d{UNIX} %{1000*%d{UNIX}} (%d{UNIX})*1000 1000*(%d{UNIX}) %n&lt;/pattern&gt;
      &lt;/PatternLayout&gt;
  &lt;/Console&gt;
  
  </code></pre>
  <p>It outputs the plain text value. Not the values after multiplication.</p>
  <pre><code>1645687086 %{1000*1645687086} (1645687086)*1000 1000*(1645687086) 
  
  </code></pre>
  <p><strong>So is there a way that I can do math operations like muliplication(*) and modulo(%) inside the xml tag itself?</strong></p>