File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
src/main/java/com/dtstack/flink/sql Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 115115 <artifactId >flink-statebackend-rocksdb_2.11</artifactId >
116116 <version >${flink.version} </version >
117117 </dependency >
118-
118+ <dependency >
119+ <groupId >ch.qos.logback</groupId >
120+ <artifactId >logback-classic</artifactId >
121+ <version >1.1.7</version >
122+ </dependency >
119123
120124 </dependencies >
121125
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 )) {
@@ -304,4 +306,10 @@ private static StreamExecutionEnvironment getStreamExeEnv(Properties confPropert
304306 StreamEnvConfigManager .streamExecutionEnvironmentConfig (env , confProperties );
305307 return env ;
306308 }
309+ private static void setLogLevel (String level ){
310+ LoggerContext loggerContext = (LoggerContext ) LoggerFactory .getILoggerFactory ();
311+ //设置全局日志级别
312+ ch .qos .logback .classic .Logger logger = loggerContext .getLogger ("root" );
313+ logger .setLevel (Level .toLevel (level , Level .INFO ));
314+ }
307315}
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