Skip to content

Commit d900b09

Browse files
author
dapeng
committed
Merge branch 'feat_logLevel_mergeTest' into '1.8_test_3.10.x'
Feat log level merge test See merge request !269
2 parents 1f8353e + 035b44f commit d900b09

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ sh submit.sh -sql D:\sideSql.txt -name xctest -remoteSqlPluginPath /opt/dtstack
181181
* 描述:yarn session 模式下指定的运行的一些参数,[可参考](https://ci.apache.org/projects/flink/flink-docs-release-1.8/ops/cli.html),目前只支持指定yid
182182
* 必选:否
183183
* 默认值:false
184+
185+
* **logLevel**
186+
* 描述:设定日志级别
187+
* 必选:否
188+
* 默认值:info
184189

185190
## 2 结构
186191
### 2.1 源表插件

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
@@ -68,6 +68,9 @@ public class Options {
6868

6969
@OptionRequired(description = "plugin load mode, by classpath or shipfile")
7070
private String pluginLoadMode = EPluginLoadMode.CLASSPATH.name();
71+
72+
@OptionRequired(description = "log level")
73+
private String logLevel = "info";
7174

7275
public String getMode() {
7376
return mode;
@@ -173,4 +176,11 @@ public void setPluginLoadMode(String pluginLoadMode) {
173176
this.pluginLoadMode = pluginLoadMode;
174177
}
175178

179+
public String getLogLevel() {
180+
return logLevel;
181+
}
182+
183+
public void setLogLevel(String logLevel) {
184+
this.logLevel = logLevel;
185+
}
176186
}

launcher/pom.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>sql.launcher</artifactId>
13-
1413
<dependencies>
1514
<dependency>
1615
<groupId>com.dtstack.flink</groupId>
@@ -35,7 +34,11 @@
3534
<artifactId>fastjson</artifactId>
3635
<version>1.2.7</version>
3736
</dependency>
38-
37+
<dependency>
38+
<groupId>com.aiweiergou</groupId>
39+
<artifactId>tools-logger</artifactId>
40+
<version>${logger.tool.version}</version>
41+
</dependency>
3942
</dependencies>
4043

4144
<build>

launcher/src/main/java/com/dtstack/flink/sql/launcher/LauncherMain.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
package com.dtstack.flink.sql.launcher;
2222

23+
import com.aiweiergou.tool.logger.api.ChangeLogLevelProcess;
2324
import com.dtstack.flink.sql.constrant.ConfigConstrant;
2425
import com.google.common.collect.Lists;
2526
import com.alibaba.fastjson.JSON;
@@ -83,6 +84,8 @@ public static void main(String[] args) throws Exception {
8384
confProp = URLDecoder.decode(confProp, Charsets.UTF_8.toString());
8485
Properties confProperties = PluginUtil.jsonStrToObject(confProp, Properties.class);
8586

87+
setLogLevel(launcherOptions.getLogLevel());
88+
8689
if(mode.equals(ClusterMode.local.name())) {
8790
String[] localArgs = argList.toArray(new String[argList.size()]);
8891
Main.main(localArgs);
@@ -146,4 +149,12 @@ private static String[] parseJson(String[] args) {
146149
String[] array = list.toArray(new String[list.size()]);
147150
return array;
148151
}
152+
153+
private static void setLogLevel(String logLevel){
154+
if(org.apache.commons.lang3.StringUtils.isBlank(logLevel)){
155+
return;
156+
}
157+
ChangeLogLevelProcess logLevelProcess = new ChangeLogLevelProcess();
158+
logLevelProcess.process(logLevel);
159+
}
149160
}

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<properties>
4242
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4343
<flink.version>1.8.1</flink.version>
44+
<logger.tool.version>1.0.0-SNAPSHOT</logger.tool.version>
4445
</properties>
4546

4647
<build>

0 commit comments

Comments
 (0)