Jalal
Jalal

Reputation: 1246

Is it possible to disable MDC logging fields in logback for a specific appender/logger?

I need to add an additional logging layer to a project (SpringBoot+LogBack). Currently some fields are added to the MDC to be included in the logs, which is fine.

In the new logging layer, I use a new appender and logger and I need to exclude the MDC fields from these log entries, is that possible?

Upvotes: 2

Views: 2555

Answers (1)

Jalal
Jalal

Reputation: 1246

Found a solution, posting it as an answer to save time for others. It is possible using logback logstash encoder. You simply can add <includeMdc>false</includeMdc> to the appender.

Upvotes: 1

Related Questions