我在 application.yml
中设置了 Spring Boot 应用程序的日志记录级别,如下所示:
logging.level.com.Myapplicationname=DEBUG
该应用程序被打包并部署为对 tomcat 的战争。除此之外,我还没有设置 logback.xml
来定义日志文件等。
当某些用户通过浏览器使用应用程序时,我在哪里可以看到控制台日志?
框架是否创建了任何默认文件?
原文由 Megan 发布,翻译遵循 CC BY-SA 4.0 许可协议
在 Spring-Boot 2.3.x 之前
You should either specify
logging.file
orlogging.path
, but not both ( when both are specified,logging.path
is ignored and onlylogging.file
is considered) .1. 使用 logging.file
您可以使用
logging.file
以下方式之一:在 Spring Boot 文档 中:
在 Spring Boot 的如何记录文档中:
2. 使用 logging.path
您也可以使用
logging.path
设置路径,在这种情况下,日志文件将自动命名为spring.log
:在 Spring Boot 文档 中:
springframework.guru 关于 Spring Boot 日志记录:
从 Spring-Boot 2.3.x 开始
The previously used properties
logging.file
orlogging.path
became deprecated in Spring-Boot 2.2.x and were replaced in version 2.3.x withlogging.file.name
andlogging.file.path
.请参阅 Spring Boot 文档。