Skip to content

Commit 1102512

Browse files
author
xuchao
committed
添加本地调试模块的日志设置
1 parent 8eb345b commit 1102512

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

localTest/src/main/java/com/dtstack/flink/sql/localTest/LocalTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package com.dtstack.flink.sql.localTest;
2020

21+
import ch.qos.logback.classic.Level;
22+
import ch.qos.logback.classic.LoggerContext;
2123
import com.alibaba.fastjson.JSONObject;
2224
import com.dtstack.flink.sql.Main;
2325
import org.slf4j.Logger;
@@ -32,6 +34,7 @@
3234
import java.util.HashMap;
3335
import java.util.List;
3436
import java.util.Map;
37+
import java.util.TimeZone;
3538

3639
/**
3740
* @author tiezhu
@@ -44,13 +47,16 @@ public class LocalTest {
4447

4548
public static void main(String[] args) throws Exception {
4649

50+
setLogLevel("INFO");
51+
4752
List<String> propertiesList = new ArrayList<>();
48-
String sqlPath = "/Users/wtz4680/Desktop/flinkStreamSQL/Bug/Redmine_25807.sql";
53+
String sqlPath = "/Users/xuchao/Documents/flinkSql/share/twodimjoin.sql";
4954
Map<String, Object> conf = new HashMap<>();
5055
JSONObject properties = new JSONObject();
5156

5257
//其他参数配置
5358
properties.put("time.characteristic", "eventTime");
59+
properties.put("timezone", TimeZone.getDefault());
5460

5561
// 任务配置参数
5662
conf.put("-sql", URLEncoder.encode(readSQL(sqlPath), StandardCharsets.UTF_8.name()));
@@ -76,4 +82,10 @@ private static String readSQL(String sqlPath) {
7682
throw new RuntimeException(ioe);
7783
}
7884
}
85+
86+
private static void setLogLevel(String level) {
87+
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
88+
ch.qos.logback.classic.Logger logger = loggerContext.getLogger("root");
89+
logger.setLevel(Level.toLevel(level));
90+
}
7991
}

0 commit comments

Comments
 (0)