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