Skip to content

Commit 4f3c1ad

Browse files
author
zengqiao
committed
优化corn表达式解析失败后退出无任何日志提示问题
1 parent 3b0c208 commit 4f3c1ad

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

kafka-manager-task/src/main/java/com/xiaojukeji/kafka/manager/task/component/AbstractScheduledTask.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,9 @@ private boolean checkAndModifyCron(String scheduledName, String scheduledCron, b
8080
return true;
8181
}
8282

83-
LOGGER.error("modify scheduledCron failed, format invalid, scheduledName:{} scheduledCron:{}."
84-
, scheduledName, scheduledCron);
83+
LOGGER.error("modify scheduledCron failed, format invalid, scheduledName:{} scheduledCron:{}.", scheduledName, scheduledCron);
8584
if (existIfIllegal) {
86-
System.exit(0);
85+
throw new UnsupportedOperationException(String.format("scheduledName:%s scheduledCron:%s format invalid", scheduledName, scheduledCron));
8786
}
8887
return false;
8988
}

kafka-manager-web/src/main/java/com/xiaojukeji/kafka/manager/web/MainApplication.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.slf4j.Logger;
44
import org.slf4j.LoggerFactory;
55
import org.springframework.boot.SpringApplication;
6-
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
76
import org.springframework.boot.autoconfigure.SpringBootApplication;
87
import org.springframework.boot.web.servlet.ServletComponentScan;
98
import org.springframework.scheduling.annotation.EnableAsync;
@@ -17,7 +16,6 @@
1716
@EnableAsync
1817
@EnableScheduling
1918
@ServletComponentScan
20-
@EnableAutoConfiguration
2119
@SpringBootApplication(scanBasePackages = {"com.xiaojukeji.kafka.manager"})
2220
public class MainApplication {
2321
private static final Logger LOGGER = LoggerFactory.getLogger(MainApplication.class);
@@ -28,7 +26,8 @@ public static void main(String[] args) {
2826
sa.run(args);
2927
LOGGER.info("MainApplication started");
3028
} catch (Exception e) {
31-
e.printStackTrace();
29+
LOGGER.error("start failed and application exit", e);
30+
System.exit(1);
3231
}
3332
}
3433
}

0 commit comments

Comments
 (0)