If I have a KeyValuePair in my JsonLayout appender, and that pair is not set in the MDC, is there a way to exclude the value from the logs?
In Java,
You can use ':-' for null value in log4j2.xml
Example:
<KeyValuePair key="traceId" value="$${ctx:traceId:-}"/>