title: How can I combine PrettyPrintingJsonGeneratorDecorator and MaskingJsonGeneratorDecorator together?
body: <p>I've tried to config the <code>logstash-logback-encoder</code> version <code>6.4</code> to print the pretty print JSON as</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;appender name=&quot;consoleAsJSON&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;
      &lt;encoder class=&quot;net.logstash.logback.encoder.LogstashEncoder&quot;&gt;
          &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator&quot;/&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>The output is <code>pretty print</code> as expected. Then I step forward to config with masking as</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;appender name=&quot;consoleAsJSON&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;
      &lt;encoder class=&quot;net.logstash.logback.encoder.LogstashEncoder&quot;&gt;
          &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.mask.MaskingJsonGeneratorDecorator&quot;&gt;
              &lt;defaultMask&gt;XXXX&lt;/defaultMask&gt;
              &lt;path&gt;password&lt;/path&gt;
          &lt;/jsonGeneratorDecorator&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>The output is <code>marked</code> as expected, too.</p>
  <p>Anyhow when I combine these two together, it only does one thing, either <code>pretty print</code> or <code>masked</code>.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;appender name=&quot;consoleAsJSON&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;
      &lt;encoder class=&quot;net.logstash.logback.encoder.LogstashEncoder&quot;&gt;
          &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator&quot;/&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.mask.MaskingJsonGeneratorDecorator&quot;&gt;
              &lt;defaultMask&gt;XXXX&lt;/defaultMask&gt;
              &lt;path&gt;password&lt;/path&gt;
          &lt;/jsonGeneratorDecorator&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>It only does the <code>masked</code>, but <code>not pretty print</code>.</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;appender name=&quot;consoleAsJSON&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;
      &lt;encoder class=&quot;net.logstash.logback.encoder.LogstashEncoder&quot;&gt;
          &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.mask.MaskingJsonGeneratorDecorator&quot;&gt;
              &lt;defaultMask&gt;XXXX&lt;/defaultMask&gt;
              &lt;path&gt;password&lt;/path&gt;
          &lt;/jsonGeneratorDecorator&gt;
          &lt;jsonGeneratorDecorator class=&quot;net.logstash.logback.decorate.PrettyPrintingJsonGeneratorDecorator&quot;/&gt;
      &lt;/encoder&gt;
  &lt;/appender&gt;
  </code></pre>
  <p>It only does the <code>pretty print</code>, but <code>not masked</code>.</p>
  <p>How can I combine <code>PrettyPrintingJsonGeneratorDecorator</code> and <code>MaskingJsonGeneratorDecorator</code> together? Could you please help to advise?</p>