<?xml version="1.0" encoding="UTF-8"?>
<configuration status="error">
<appenders>
<Console name="Console" target="SYSTEM_OUT" >
<ThresholdFilter level="trace" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n" />
</Console>
<RollingFile name="RollingFile" fileName="E:/workspace/payPlatform/logs/payPlatform.log" filePattern="E:/workspace/payPlatform/logs/$${date:yyyy-MM}/payPlatform-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n" />
<SizeBasedTriggeringPolicy size="1 k" />
</RollingFile>
</appenders>
<loggers>
<root level="all">
<appender-ref ref="RollingFile" />
<appender-ref ref="Console" />
</root>
</loggers>
</configuration>
------解决思路----------------------
<configuration status="error">
//定义一个这样的路径变量
<properties>
<property name="filenameLog">logs/payPlatform.log</property>
</properties>
//使用
<RollingFile name="RollingFile"fileName=""${filenameLog}"" filePattern="$${date:yyyyMMdd}/payPlatform_%d{yyyyMMdd}_%i.log.gz">
<PatternLayout pattern="%d{yyyy.MM.dd 'at' HH:mm:ss z} %-5level %class{36} %L %M - %msg%xEx%n" />
<SizeBasedTriggeringPolicy size="1 k" />
</RollingFile>
</appenders>
这样就可以啦
祝你好运