Explorar o código

1.解决日志乱码问题

luxueshi %!s(int64=3) %!d(string=hai) anos
pai
achega
e6ddff13dc
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/main/resources/log4j.xml

+ 2 - 0
src/main/resources/log4j.xml

@@ -14,6 +14,7 @@
     <appender name="fileAppenderInfo" class="org.apache.log4j.DailyRollingFileAppender">
         <param name="File" value="D:/minitor-logs/info.log" />
         <param name="DatePattern" value=".yyyy-MM-dd" />
+        <param name="encoding" value="UTF-8" />
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
         </layout>
@@ -27,6 +28,7 @@
     <appender name="fileAppenderError" class="org.apache.log4j.DailyRollingFileAppender">
         <param name="File" value="D:/minitor-logs/error.log" />
         <param name="DatePattern" value=".yyyy-MM-dd" />
+        <param name="encoding" value="UTF-8" />
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="[%d{HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
         </layout>