我运行我的spring-boot应用程序,但日志未写入在logback-spring.xml中对其进行配置的日志路径中
server:
port: 8090
jndi: ${jndi}
layout:
properties_file: ${layout.properties_file}
logging:
config: classpath:logback-spring.xml
这是application.yml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE" value="C:/log/log.log" /> ---> not log writed in this path
<property name="LOG_FILE_MAX_SIZE" value="500MB" />
<property name="LOG_TOTAL_SIZE_CAP" value="5GB" />
<property name="LOG_FILE_MAX_HISTORY" value="90" />
<logger name="org.springframework.security" level="DEBUG" />
<logger name="org.springframework.session" level="TRACE" />
<logger name="org.hibernate.SQL" level="DEBUG" />
<logger name="org.hibernate.type.descriptor.sql.BasicBinder"
level="TRACE" />
<include resource="file-appender.xml" />
<include
resource="org/springframework/boot/logging/logback/console-appender.xml" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</configuration>
这是logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://github.com/spring-projects/spring-boot/blob/v2.0.0.M5/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback/file-appender.xml -->
<!-- File appender logback configuration provided for import, equivalent
to the programmatic initialization performed by Boot -->
<included>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
<file>${LOG_FILE}</file>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- daily rollover inferred from the file name -->
<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd-HH}.%i.log.gz</fileNamePattern>
<maxFileSize>${LOG_FILE_MAX_SIZE:-10MB}</maxFileSize>
<maxHistory>${LOG_FILE_MAX_HISTORY:-90}</maxHistory>
<totalSizeCap>${LOG_TOTAL_SIZE_CAP:-5GB}</totalSizeCap>
</rollingPolicy>
</appender>
</included>
这是file-appender.xml
所有文件都在路径“ src / main / resources”中
我尝试运行另一个具有相同'src / main / resources'功能的spring-boot应用程序
package xxx;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class xxxApplication {
public static void main(String[] args) {
SpringApplication.run(xxxApplication.class, args);
}
}
这是我的主程序