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