[问题记录] spring-boot 打印启动时间
来源:互联网 发布:女装知茵品牌 编辑:程序博客网 时间:2024/05/18 12:40
问题
spring-boot 工程启动结束会打印启动时间 Started Application in 12.805 seconds (JVM running for 20.686)
最近新建一个工程发现启动完后并没有打印上面的那句话
解决
查看源码,发现打印日志在
public ConfigurableApplicationContext run(String... args) { StopWatch stopWatch = new StopWatch(); stopWatch.start(); ConfigurableApplicationContext context = null; FailureAnalyzers analyzers = null; configureHeadlessProperty(); SpringApplicationRunListeners listeners = getRunListeners(args); listeners.starting(); try { ApplicationArguments applicationArguments = new DefaultApplicationArguments( args); ConfigurableEnvironment environment = prepareEnvironment(listeners, applicationArguments); Banner printedBanner = printBanner(environment); context = createApplicationContext(); analyzers = new FailureAnalyzers(context); prepareContext(context, environment, listeners, applicationArguments,printedBanner); //著名的refresh refreshContext(context); afterRefresh(context, applicationArguments); listeners.finished(context, null); stopWatch.stop(); //打印启动时间日志 if (this.logStartupInfo) { new StartupInfoLogger(this.mainApplicationClass) .logStarted(getApplicationLog(), stopWatch); } return context; } catch (Throwable ex) { handleRunFailure(context, listeners, analyzers, ex); throw new IllegalStateException(ex); } }
public void logStarted(Log log, StopWatch stopWatch) { if (log.isInfoEnabled()) { log.info(getStartedMessage(stopWatch)); } }
其打印是的info级日志,而我在logback配置启动类Application包的别类是WARN级别的,所以它并不打印时间,把启动类Application所在包日志级别改为info即可。
阅读全文
0 0
- [问题记录] spring-boot 打印启动时间
- Spring Boot学习记录(四)--问题记录
- Spring Boot学习记录(四)--问题记录
- Spring Boot后台启动不打印nohup.out
- 初学Spring Boot遇到的启动问题
- spring boot 程序启动缓慢的问题
- spring boot 架构问题 时间处理 (映射,时区问题)
- spring boot 架构问题 时间处理 (映射,时区问题)
- spring boot 架构问题 时间处理 (映射,时区问题)
- spring boot 架构问题 时间处理 (映射,时区问题)
- spring boot使用记录
- spring boot记录
- spring boot 日志记录
- Spring boot学习记录
- spring-boot启动
- Spring Boot热启动
- spring boot 无法启动
- Spring Boot -- 启动彩蛋
- Android网络问题
- 利用原生 jquery 制作移动端滑动时间插件
- 常用图像数据集大全
- Ranger错误:Unable to connect to Hive Thrift Server instance..
- mysql增改查的sql语句学习笔记
- [问题记录] spring-boot 打印启动时间
- 第八周项目一
- 你是如何调用 wait()方法的?使用 if 块还是循环?为什么?
- Linux内核模块
- nodejs下载及helloworld!
- VB.NET-VS2010 通过代码关闭计算机的方法
- cmd maven常用打包命令
- ssh-copy-id .sh
- 第10周 【项目1