<?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>
log4j2 如何设置编码
------解决思路----------------------
我也遇到同样的问题了,
<PatternLayout charset="GBK" pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
似乎加个charset就好了。