解决方案:在logbak.xml中添加<charset>UTF-8</charset>即可
<appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<!-- <onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
--> </filter>
<encoder>
<pattern>%d{HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!--滚动策略-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!--路径-->
<fileNamePattern>./logs/%d{yyyy-MM-dd}/%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
</appender> |
因为idea自带的tomcat默认的编码格式是GBK,如果不设置<charset>UTF-8</charset>,则获取默认格式。