This commit is contained in:
xxy 2019-12-12 21:56:39 +08:00
parent 72d733b8fb
commit 6b59b7b899
2 changed files with 13 additions and 12 deletions

View File

@ -23,18 +23,19 @@ public class StartListener implements ApplicationListener<ContextRefreshedEvent>
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
log.info("程序启动");
crawlBook();
new Thread(()->{
while (true) {
try {
log.info("crawlBooks执行中。。。。。。。。。。。。");
crawlSource.parse();
Thread.sleep(1000 * 60 * 5);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}).start();
}
private void crawlBook() {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
log.debug("crawlBooks执行中。。。。。。。。。。。。");
crawlSource.parse();
crawlBook();
}
},1000*60*5);
}
}

View File

@ -56,7 +56,7 @@
<!-- 指定项目中某个包,当有日志操作行为时的日志记录级别 -->
<!-- com.maijinjie.springboot 为根包也就是只要是发生在这个根包下面的所有日志操作行为的权限都是DEBUG -->
<!-- 级别依次为【从高到低】FATAL > ERROR > WARN > INFO > DEBUG > TRACE -->
<logger name="xyz.zinglizingli" level="DEBUG">
<logger name="xyz.zinglizingli" level="INFO">
<appender-ref ref="debug" />
</logger>
</configuration>