I am using logback.xml to mask sensitive data for logging which works fine
<appender name="DATA_MASK" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="com.masking.MaskingPatternLayout">
<maskPattern>\"creditCardNumber\"\s*:\s*\"(.*?)\"</maskPattern> <!-- questionCode JSON pattern -->
<Pattern>${logback.detailedroot}</Pattern>
</layout>
</encoder>
</appender>
But the problem is that this custom MaskingPatternLayout does not catch the request-response log when I turn on the request-response config in logback.xml
<logger name="Request" level="DEBUG" />
<logger name="Response" level="DEBUG" />
As we know, the two configs above help us catch all requests and responses as logs. However, the masking pattern does not work for them. Any way the handle these request-response logs to mask.