DBZ-5180 Put the MysqlPartition values to MDC getting NPE in logging context phase

This commit is contained in:
harveyyue 2022-06-01 11:17:27 +08:00 committed by Jiri Pechanec
parent 7ac91c4450
commit 9a3afac243

View File

@ -99,8 +99,12 @@ public static PreviousContext forConnector(String connectorType, String connecto
if (taskId != null) {
MDC.put(TASK_ID, taskId);
}
if (partition != null) {
partition.getLoggingContext().forEach(MDC::put);
if (partition != null && partition.getLoggingContext() != null) {
partition.getLoggingContext().forEach((k, v) -> {
if (k != null && v != null) {
MDC.put(k, v);
}
});
}
MDC.put(CONNECTOR_TYPE, connectorType);
MDC.put(CONNECTOR_NAME, connectorName);