Unverified Commit f02ce97c authored by gaoyan's avatar gaoyan Committed by GitHub

fix some log print error (#2641)

* fix some log print error * formate code * fix npe * fix npe
parent 7655efe3
...@@ -26,7 +26,6 @@ import org.springframework.cache.annotation.EnableCaching; ...@@ -26,7 +26,6 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
/** /**
* Dinky Starter * Dinky Starter
...@@ -36,8 +35,12 @@ import lombok.extern.slf4j.Slf4j; ...@@ -36,8 +35,12 @@ import lombok.extern.slf4j.Slf4j;
@EnableTransactionManagement @EnableTransactionManagement
@SpringBootApplication(exclude = FreeMarkerAutoConfiguration.class) @SpringBootApplication(exclude = FreeMarkerAutoConfiguration.class)
@EnableCaching @EnableCaching
@Slf4j
public class Dinky { public class Dinky {
static {
System.setProperty("log4j2.isThreadContextMapInheritable", "true");
}
@SneakyThrows @SneakyThrows
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication app = new SpringApplication(Dinky.class); SpringApplication app = new SpringApplication(Dinky.class);
......
...@@ -117,7 +117,7 @@ public class JobRefreshHandler { ...@@ -117,7 +117,7 @@ public class JobRefreshHandler {
jobInstance.setError(jobDataDto.getErrorMsg()); jobInstance.setError(jobDataDto.getErrorMsg());
jobInfoDetail.getJobDataDto().setError(true); jobInfoDetail.getJobDataDto().setError(true);
jobInfoDetail.getJobDataDto().setErrorMsg(jobDataDto.getErrorMsg()); jobInfoDetail.getJobDataDto().setErrorMsg(jobDataDto.getErrorMsg());
if (TimeUtil.localDateTimeToLong(jobInstance.getFinishTime()) < 1) { if (jobInstance.getFinishTime() == null || TimeUtil.localDateTimeToLong(jobInstance.getFinishTime()) < 1) {
jobInstance.setFinishTime(LocalDateTime.now()); jobInstance.setFinishTime(LocalDateTime.now());
} }
} else { } else {
......
...@@ -281,7 +281,7 @@ public class JobManager { ...@@ -281,7 +281,7 @@ public class JobManager {
job.setStatus(Job.JobStatus.FAILED); job.setStatus(Job.JobStatus.FAILED);
job.setError(error); job.setError(error);
failed(); failed();
throw e; throw new Exception(error, e);
} finally { } finally {
close(); close();
} }
...@@ -316,7 +316,6 @@ public class JobManager { ...@@ -316,7 +316,6 @@ public class JobManager {
} catch (Exception e) { } catch (Exception e) {
String error = StrFormatter.format( String error = StrFormatter.format(
"Exception in executing FlinkSQL:\n{}\n{}", SqlUtil.addLineNumber(currentSql), e.getMessage()); "Exception in executing FlinkSQL:\n{}\n{}", SqlUtil.addLineNumber(currentSql), e.getMessage());
e.printStackTrace();
job.setEndTime(LocalDateTime.now()); job.setEndTime(LocalDateTime.now());
job.setStatus(Job.JobStatus.FAILED); job.setStatus(Job.JobStatus.FAILED);
job.setError(error); job.setError(error);
...@@ -324,8 +323,8 @@ public class JobManager { ...@@ -324,8 +323,8 @@ public class JobManager {
throw new Exception(error, e); throw new Exception(error, e);
} finally { } finally {
close(); close();
return job.getJobResult();
} }
return job.getJobResult();
} }
public IResult executeDDL(String statement) { public IResult executeDDL(String statement) {
...@@ -350,7 +349,7 @@ public class JobManager { ...@@ -350,7 +349,7 @@ public class JobManager {
} }
return result; return result;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("executeDDL failed:", e);
} }
return new ErrorResult(); return new ErrorResult();
} }
......
...@@ -29,7 +29,6 @@ import org.dinky.function.data.model.UDF; ...@@ -29,7 +29,6 @@ import org.dinky.function.data.model.UDF;
import org.dinky.function.util.UDFUtil; import org.dinky.function.util.UDFUtil;
import org.dinky.job.JobBuilder; import org.dinky.job.JobBuilder;
import org.dinky.job.JobManager; import org.dinky.job.JobManager;
import org.dinky.utils.LogUtil;
import org.dinky.utils.URLUtils; import org.dinky.utils.URLUtils;
import java.io.File; import java.io.File;
...@@ -118,8 +117,7 @@ public class JobUDFBuilder extends JobBuilder { ...@@ -118,8 +117,7 @@ public class JobUDFBuilder extends JobBuilder {
UDFUtil.addConfigurationClsAndJars(jarList, CollUtil.newArrayList(URLUtils.getURLs(otherPluginsFiles))); UDFUtil.addConfigurationClsAndJars(jarList, CollUtil.newArrayList(URLUtils.getURLs(otherPluginsFiles)));
} catch (Exception e) { } catch (Exception e) {
log.error("add configuration failed;reason:{}", LogUtil.getError(e)); throw new RuntimeException("add configuration failed: ", e);
throw new RuntimeException(e);
} }
log.info(StrUtil.format("A total of {} UDF have been Init.", udfList.size() + pyUdfFile.size())); log.info(StrUtil.format("A total of {} UDF have been Init.", udfList.size() + pyUdfFile.size()));
......
...@@ -44,7 +44,7 @@ updatePid() { ...@@ -44,7 +44,7 @@ updatePid() {
start() { start() {
updatePid updatePid
if [ -z "$pid" ]; then if [ -z "$pid" ]; then
nohup java -Ddruid.mysql.usePingMethod=false -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -cp "${CLASS_PATH}" org.dinky.Dinky & nohup java -Ddruid.mysql.usePingMethod=false -Dlog4j2.isThreadContextMapInheritable=true -Xms512M -Xmx2048M -XX:PermSize=512M -XX:MaxPermSize=1024M -XX:+HeapDumpOnOutOfMemoryError -Xverify:none -cp "${CLASS_PATH}" org.dinky.Dinky &
echo $! >"${PID_PATH}"/${PID_FILE} echo $! >"${PID_PATH}"/${PID_FILE}
echo "FLINK VERSION : $FLINK_VERSION" echo "FLINK VERSION : $FLINK_VERSION"
echo "........................................Start Dinky Successfully........................................" echo "........................................Start Dinky Successfully........................................"
......
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