gpt4 book ai didi

logging - Spring Boot : How to disable startup log message "Starting Application on mbp with PID 99446"

转载 作者:行者123 更新时间:2023-12-03 14:51:44 27 4
gpt4 key购买 nike

应用程序启动时有一些日志消息:

2016-11-01 10:13:49.468  INFO 99446 --- [  restartedMain] s7.Application                           : Starting Application on mbp with PID 99446 (/Users/serge/projects/scratches/s7/build/classes/main started by serge in /Users/serge/projects/scratches/s7)
2016-11-01 10:13:49.469 INFO 99446 --- [ restartedMain] s7.Application : No active profile set, falling back to default profiles: default
2016-11-01 10:13:52.642 INFO 99446 --- [ restartedMain] s7.Application : Started Application in 3.573 seconds (JVM running for 3.973)

如何禁用它们?我希望能够登录我的应用程序,但我不需要这些日志消息。

我的 application.properties 有这些设置:
spring.main.banner-mode=off
logging.level.org.springframework=WARN
logging.level.org.apache=WARN
logging.level.org.mongodb=WARN

最佳答案

您可以通过配置您的 SpringApplication 来禁用这三个日志消息。不记录启动信息:

        new SpringApplicationBuilder(YourApplication.class)
.logStartupInfo(false)
.run(args);

或者,如果您想坚持使用基于日志级别的方法,则使用应用程序主类的记录器记录它们。从上面的输出来看,它被称为 s7.Application因此,您还可以通过将以下内容添加到 application.properties 来禁用消息:
logging.level.s7.Application=WARN

关于logging - Spring Boot : How to disable startup log message "Starting Application on mbp with PID 99446",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40359108/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com