Unverified Commit 4945cb71 authored by Zzih's avatar Zzih Committed by GitHub

Fix [*] Replace System.out.println with logger.info (#1069)

* Replace System.out.println with logger.info

* Delete System.out.println

* update import;
parent 0765de2c
...@@ -184,7 +184,6 @@ public class Submiter { ...@@ -184,7 +184,6 @@ public class Submiter {
logger.error("执行失败, {}", e.getMessage(), e); logger.error("执行失败, {}", e.getMessage(), e);
} }
} }
logger.info(LocalDateTime.now() + "任务提交成功"); logger.info("{}任务提交成功",LocalDateTime.now());
System.out.println(LocalDateTime.now() + "任务提交成功");
} }
} }
...@@ -39,6 +39,9 @@ import java.util.Optional; ...@@ -39,6 +39,9 @@ import java.util.Optional;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 定制TableResultImpl * 定制TableResultImpl
* *
...@@ -47,6 +50,7 @@ import javax.annotation.Nullable; ...@@ -47,6 +50,7 @@ import javax.annotation.Nullable;
**/ **/
@Internal @Internal
class CustomTableResultImpl implements TableResult { class CustomTableResultImpl implements TableResult {
protected static final Logger logger = LoggerFactory.getLogger(CustomTableResultImpl.class);
public static final TableResult TABLE_RESULT_OK = public static final TableResult TABLE_RESULT_OK =
CustomTableResultImpl.builder() CustomTableResultImpl.builder()
.resultKind(ResultKind.SUCCESS) .resultKind(ResultKind.SUCCESS)
...@@ -123,7 +127,7 @@ class CustomTableResultImpl implements TableResult { ...@@ -123,7 +127,7 @@ class CustomTableResultImpl implements TableResult {
deriveColumnWidthByType); deriveColumnWidthByType);
} else if (printStyle instanceof RawContentStyle) { } else if (printStyle instanceof RawContentStyle) {
while (it.hasNext()) { while (it.hasNext()) {
System.out.println(String.join(",", PrintUtils.rowToString(it.next()))); logger.info(String.join(",", PrintUtils.rowToString(it.next())));
} }
} else { } else {
throw new TableException("Unsupported print style: " + printStyle); throw new TableException("Unsupported print style: " + printStyle);
......
...@@ -45,6 +45,9 @@ import java.util.concurrent.TimeoutException; ...@@ -45,6 +45,9 @@ import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 定制CustomTableResultImpl * 定制CustomTableResultImpl
* *
...@@ -53,6 +56,7 @@ import javax.annotation.Nullable; ...@@ -53,6 +56,7 @@ import javax.annotation.Nullable;
**/ **/
@Internal @Internal
class CustomTableResultImpl implements TableResult { class CustomTableResultImpl implements TableResult {
private static Logger logger = LoggerFactory.getLogger(CustomTableResultImpl.class);
public static final TableResult TABLE_RESULT_OK = public static final TableResult TABLE_RESULT_OK =
CustomTableResultImpl.builder() CustomTableResultImpl.builder()
.resultKind(ResultKind.SUCCESS) .resultKind(ResultKind.SUCCESS)
...@@ -179,7 +183,7 @@ class CustomTableResultImpl implements TableResult { ...@@ -179,7 +183,7 @@ class CustomTableResultImpl implements TableResult {
printRowKind); printRowKind);
} else if (printStyle instanceof RawContentStyle) { } else if (printStyle instanceof RawContentStyle) {
while (it.hasNext()) { while (it.hasNext()) {
System.out.println(String.join(",", PrintUtils.rowToString(it.next()))); logger.info(String.join(",", PrintUtils.rowToString(it.next())));
} }
} else { } else {
throw new TableException("Unsupported print style: " + printStyle); throw new TableException("Unsupported print style: " + printStyle);
......
...@@ -49,6 +49,9 @@ import java.util.concurrent.TimeoutException; ...@@ -49,6 +49,9 @@ import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 定制CustomTableResultImpl * 定制CustomTableResultImpl
* *
...@@ -57,6 +60,7 @@ import javax.annotation.Nullable; ...@@ -57,6 +60,7 @@ import javax.annotation.Nullable;
**/ **/
@Internal @Internal
public class CustomTableResultImpl implements TableResult { public class CustomTableResultImpl implements TableResult {
protected static final Logger logger = LoggerFactory.getLogger(CustomTableResultImpl.class);
public static final TableResult TABLE_RESULT_OK = public static final TableResult TABLE_RESULT_OK =
CustomTableResultImpl.builder() CustomTableResultImpl.builder()
.resultKind(ResultKind.SUCCESS) .resultKind(ResultKind.SUCCESS)
...@@ -190,7 +194,7 @@ public class CustomTableResultImpl implements TableResult { ...@@ -190,7 +194,7 @@ public class CustomTableResultImpl implements TableResult {
sessionTimeZone); sessionTimeZone);
} else if (printStyle instanceof RawContentStyle) { } else if (printStyle instanceof RawContentStyle) {
while (it.hasNext()) { while (it.hasNext()) {
System.out.println( logger.info(
String.join( String.join(
",", ",",
PrintUtils.rowToString( PrintUtils.rowToString(
......
...@@ -49,6 +49,9 @@ import java.util.concurrent.TimeoutException; ...@@ -49,6 +49,9 @@ import java.util.concurrent.TimeoutException;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* 定制TableResultImpl * 定制TableResultImpl
* *
...@@ -57,6 +60,7 @@ import javax.annotation.Nullable; ...@@ -57,6 +60,7 @@ import javax.annotation.Nullable;
**/ **/
@Internal @Internal
public class CustomTableResultImpl implements TableResult { public class CustomTableResultImpl implements TableResult {
protected static final Logger logger = LoggerFactory.getLogger(CustomTableResultImpl.class);
public static final TableResult TABLE_RESULT_OK = public static final TableResult TABLE_RESULT_OK =
CustomTableResultImpl.builder() CustomTableResultImpl.builder()
.resultKind(ResultKind.SUCCESS) .resultKind(ResultKind.SUCCESS)
...@@ -190,7 +194,7 @@ public class CustomTableResultImpl implements TableResult { ...@@ -190,7 +194,7 @@ public class CustomTableResultImpl implements TableResult {
sessionTimeZone); sessionTimeZone);
} else if (printStyle instanceof RawContentStyle) { } else if (printStyle instanceof RawContentStyle) {
while (it.hasNext()) { while (it.hasNext()) {
System.out.println( logger.info(
String.join( String.join(
",", ",",
PrintUtils.rowToString( PrintUtils.rowToString(
......
...@@ -34,6 +34,9 @@ import java.util.List; ...@@ -34,6 +34,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExpr; import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.ast.SQLStatement;
...@@ -43,6 +46,7 @@ import com.alibaba.druid.sql.ast.statement.SQLInsertStatement; ...@@ -43,6 +46,7 @@ import com.alibaba.druid.sql.ast.statement.SQLInsertStatement;
import com.alibaba.druid.stat.TableStat; import com.alibaba.druid.stat.TableStat;
public class LineageBuilder { public class LineageBuilder {
protected static final Logger logger = LoggerFactory.getLogger(LineageBuilder.class);
public static LineageResult getSqlLineageByOne(String statement, String type) { public static LineageResult getSqlLineageByOne(String statement, String type) {
List<LineageTable> tables = new ArrayList<>(); List<LineageTable> tables = new ArrayList<>();
List<LineageRelation> relations = new ArrayList<>(); List<LineageRelation> relations = new ArrayList<>();
...@@ -115,7 +119,7 @@ public class LineageBuilder { ...@@ -115,7 +119,7 @@ public class LineageBuilder {
int tSize = tgtList.size(); int tSize = tgtList.size();
int sSize = srcLists.size(); int sSize = srcLists.size();
if (tSize != sSize && tSize * 2 != sSize) { if (tSize != sSize && tSize * 2 != sSize) {
System.out.println("出现字段位数不相等错误"); logger.info("出现字段位数不相等错误");
return null; return null;
} }
for (int i = 0; i < tSize; i++) { for (int i = 0; i < tSize; i++) {
...@@ -249,7 +253,7 @@ public class LineageBuilder { ...@@ -249,7 +253,7 @@ public class LineageBuilder {
int tSize = tgtList.size(); int tSize = tgtList.size();
int sSize = srcLists.size(); int sSize = srcLists.size();
if (tSize != sSize && tSize * 2 != sSize) { if (tSize != sSize && tSize * 2 != sSize) {
System.out.println("出现字段位数不相等错误"); logger.info("出现字段位数不相等错误");
return null; return null;
} }
for (int i = 0; i < tSize; i++) { for (int i = 0; i < tSize; i++) {
......
...@@ -25,6 +25,9 @@ import java.util.ArrayList; ...@@ -25,6 +25,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.druid.sql.SQLUtils; import com.alibaba.druid.sql.SQLUtils;
import com.alibaba.druid.sql.ast.SQLExpr; import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.ast.SQLStatement;
...@@ -49,6 +52,7 @@ import com.alibaba.druid.sql.ast.statement.SQLUnionQuery; ...@@ -49,6 +52,7 @@ import com.alibaba.druid.sql.ast.statement.SQLUnionQuery;
import com.alibaba.druid.sql.ast.statement.SQLUnionQueryTableSource; import com.alibaba.druid.sql.ast.statement.SQLUnionQueryTableSource;
public class LineageUtils { public class LineageUtils {
protected static final Logger logger = LoggerFactory.getLogger(LineageUtils.class);
public static void columnLineageAnalyzer(String sql, String type, TreeNode<LineageColumn> node) { public static void columnLineageAnalyzer(String sql, String type, TreeNode<LineageColumn> node) {
if (Asserts.isNullString(sql)) { if (Asserts.isNullString(sql)) {
...@@ -62,7 +66,7 @@ public class LineageUtils { ...@@ -62,7 +66,7 @@ public class LineageUtils {
try { try {
statements = SQLUtils.parseStatements(sql, type); statements = SQLUtils.parseStatements(sql, type);
} catch (Exception e) { } catch (Exception e) {
System.out.println("can't parser by druid " + type + e); logger.info("can't parser by druid {}",type,e);
} }
// 只考虑一条语句 // 只考虑一条语句
......
...@@ -29,6 +29,8 @@ import java.util.List; ...@@ -29,6 +29,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.codehaus.groovy.control.CompilerConfiguration; import org.codehaus.groovy.control.CompilerConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
...@@ -43,6 +45,7 @@ import groovy.lang.GroovyClassLoader; ...@@ -43,6 +45,7 @@ import groovy.lang.GroovyClassLoader;
* @since 2021/12/27 23:25 * @since 2021/12/27 23:25
*/ */
public class UDFUtil { public class UDFUtil {
protected static final Logger logger = LoggerFactory.getLogger(UDFUtil.class);
public static void buildClass(String code) { public static void buildClass(String code) {
CustomStringJavaCompiler compiler = new CustomStringJavaCompiler(code); CustomStringJavaCompiler compiler = new CustomStringJavaCompiler(code);
...@@ -51,12 +54,12 @@ public class UDFUtil { ...@@ -51,12 +54,12 @@ public class UDFUtil {
String className = compiler.getFullClassName(); String className = compiler.getFullClassName();
byte[] compiledBytes = compiler.getJavaFileObjectMap(className).getCompiledBytes(); byte[] compiledBytes = compiler.getJavaFileObjectMap(className).getCompiledBytes();
ClassPool.push(new ClassEntity(className, code, compiledBytes)); ClassPool.push(new ClassEntity(className, code, compiledBytes));
System.out.println("编译成功"); logger.info("编译成功");
System.out.println("compilerTakeTime:" + compiler.getCompilerTakeTime()); logger.info("compilerTakeTime:{}",compiler.getCompilerTakeTime());
initClassLoader(className); initClassLoader(className);
} else { } else {
System.out.println("编译失败"); logger.info("编译失败");
System.out.println(compiler.getCompilerMessage()); logger.info(compiler.getCompilerMessage());
} }
} }
...@@ -84,12 +87,12 @@ public class UDFUtil { ...@@ -84,12 +87,12 @@ public class UDFUtil {
boolean res = compiler.compilerToTmpPath(tmpPath); boolean res = compiler.compilerToTmpPath(tmpPath);
String className = compiler.getFullClassName(); String className = compiler.getFullClassName();
if (res) { if (res) {
System.out.println("编译成功"); logger.info("编译成功");
System.out.println("compilerTakeTime:" + compiler.getCompilerTakeTime()); logger.info("compilerTakeTime:{}",compiler.getCompilerTakeTime());
successList.add(className); successList.add(className);
} else { } else {
System.out.println("编译失败"); logger.info("编译失败");
System.out.println(compiler.getCompilerMessage()); logger.info(compiler.getCompilerMessage());
failedList.add(className); failedList.add(className);
} }
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment