【发布时间】:2016-07-28 15:36:09
【问题描述】:
我创建了一个log4j.properties 文件,并将它作为application.properties 文件放在资源文件夹中,在这个文件中我有这一行:logging.config=log4j.properties,它表示我的 log4j 属性文件的名称,但是当我运行我的应用程序时,我的控制台上出现了这个错误:
Logging system failed to initialize using configuration from 'log4j.properties'
java.io.FileNotFoundException: C:\Users\***\Desktop\CapRecrute\log4j.properties (The system cannot find the file specified)
所以我尝试将logging.config 属性更改为src\\main\\resources\\log4j.properties,然后又遇到了另一个错误:
java.lang.IllegalStateException: Could not initialize Logback logging from src\main\resources\log4j.properties ... Caused by: ch.qos.logback.core.LogbackException: Unexpected filename extension of file [file:/C:/Users/Aimad%20MAJDOU/Desktop/CapRecrute/src/main/resources/log4j.properties]. Should be either .groovy or .xml
在我的 pom 文件中我有这个:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
我该如何解决这个问题?
【问题讨论】:
标签: spring-boot log4j