mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
增加日志配置 fix #1570
This commit is contained in:
@@ -30,6 +30,7 @@ import com.alibaba.otter.canal.client.adapter.es.service.ESEtlService;
|
||||
import com.alibaba.otter.canal.client.adapter.es.service.ESSyncService;
|
||||
import com.alibaba.otter.canal.client.adapter.es.support.ESTemplate;
|
||||
import com.alibaba.otter.canal.client.adapter.support.*;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
/**
|
||||
* ES外部适配器
|
||||
@@ -70,6 +71,7 @@ public class ESAdapter implements OuterAdapter {
|
||||
@Override
|
||||
public void init(OuterAdapterConfig configuration, Properties envProperties) {
|
||||
try {
|
||||
MDC.put("adapter", "es");
|
||||
this.envProperties = envProperties;
|
||||
Map<String, ESSyncConfig> esSyncConfigTmp = ESSyncConfigLoader.load(envProperties);
|
||||
// 过滤不匹配的key的配置
|
||||
@@ -239,6 +241,7 @@ public class ESAdapter implements OuterAdapter {
|
||||
if (transportClient != null) {
|
||||
transportClient.close();
|
||||
}
|
||||
MDC.remove("adapter");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,7 +15,8 @@ public class SqlParseTest {
|
||||
|
||||
@Test
|
||||
public void parseTest() {
|
||||
String sql = "select a.id, concat(a.name,'_test') as name, a.role_id, b.name as role_name, c.labels from user a "
|
||||
String sql = "select a.id, CASE WHEN a.id <= 500 THEN '1' else '2' end as id2, "
|
||||
+ "concat(a.name,'_test') as name, a.role_id, b.name as role_name, c.labels from user a "
|
||||
+ "left join role b on a.role_id=b.id "
|
||||
+ "left join (select user_id, group_concat(label,',') as labels from user_label "
|
||||
+ "group by user_id) c on c.user_id=a.id";
|
||||
|
||||
Reference in New Issue
Block a user