Skip to content

Commit 8568bb4

Browse files
Merge branch 'v1.8.0_dev' of ssh://git.dtstack.cn:10022/dt-insight-engine/flinkStreamSQL into hotfix_1.8_3.10.2_21725
2 parents f7922de + a690319 commit 8568bb4

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

core/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@
121121
<artifactId>junit</artifactId>
122122
<version>4.12</version>
123123
</dependency>
124+
<dependency>
125+
<groupId>ch.qos.logback</groupId>
126+
<artifactId>logback-classic</artifactId>
127+
<version>1.1.7</version>
128+
</dependency>
124129

125130
</dependencies>
126131

core/src/main/java/com/dtstack/flink/sql/Main.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
import java.util.Set;
7878

7979
import com.dtstack.flink.sql.option.Options;
80+
import ch.qos.logback.classic.Level;
81+
import ch.qos.logback.classic.LoggerContext;
8082

8183
/**
8284
* Date: 2018/6/26
@@ -105,9 +107,9 @@ public static void main(String[] args) throws Exception {
105107
String pluginLoadMode = options.getPluginLoadMode();
106108
String deployMode = options.getMode();
107109
String confProp = options.getConfProp();
108-
109110
sql = URLDecoder.decode(sql, Charsets.UTF_8.name());
110111
SqlParser.setLocalSqlPluginRoot(localSqlPluginPath);
112+
setLogLevel(options.getLogLevel());
111113

112114
List<String> addJarFileList = Lists.newArrayList();
113115
if (!Strings.isNullOrEmpty(addJarListStr)) {
@@ -308,4 +310,10 @@ private static StreamExecutionEnvironment getStreamExeEnv(Properties confPropert
308310
StreamEnvConfigManager.streamExecutionEnvironmentConfig(env, confProperties);
309311
return env;
310312
}
313+
private static void setLogLevel(String level){
314+
LoggerContext loggerContext= (LoggerContext) LoggerFactory.getILoggerFactory();
315+
//设置全局日志级别
316+
ch.qos.logback.classic.Logger logger = loggerContext.getLogger("root");
317+
logger.setLevel(Level.toLevel(level, Level.INFO));
318+
}
311319
}

core/src/main/java/com/dtstack/flink/sql/option/Options.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class Options {
6969
@OptionRequired(description = "plugin load mode, by classpath or shipfile")
7070
private String pluginLoadMode = EPluginLoadMode.CLASSPATH.name();
7171

72+
private String logLevel = "logLevel";
73+
7274
public String getMode() {
7375
return mode;
7476
}
@@ -172,4 +174,12 @@ public String getPluginLoadMode() {
172174
public void setPluginLoadMode(String pluginLoadMode) {
173175
this.pluginLoadMode = pluginLoadMode;
174176
}
177+
178+
public String getLogLevel() {
179+
return logLevel;
180+
}
181+
182+
public void setLogLevel(String logLevel) {
183+
this.logLevel = logLevel;
184+
}
175185
}

0 commit comments

Comments
 (0)