File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
src/main/java/com/dtstack/flink/sql Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 7777import java .util .Set ;
7878
7979import 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}
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments