2 回答

TA贡献2021条经验 获得超8个赞
如果您在pom.xmlthen中具有以下依赖项,spring-boot则将使用嵌入在此依赖项中的自己的默认日志记录(logback)(您可以在选项卡上dependency hierarchy签入 IDE):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
为了禁用默认日志记录,您需要将其排除:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<!-- Need to exclude spring boot's default logger in order to use log4j -->
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
在您添加此内容后,如果您已正确配置,pom.xml您将能够看到日志。log4j

TA贡献1777条经验 获得超10个赞
我尝试了几种方法终于找到了解决方案
手动添加import org.apache.log4j.BasicConfigurator;
库并在应用程序运行文件中调用该库
BasicConfigurator.configure();
添加此配置日志文件后,我们创建了我们想要的文件位置
谢谢
添加回答
举报