日期:2014-05-19  浏览次数:20674 次

log4j乱码问题(xml配置)
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration PUBLIC "-//log4j/log4j Configuration//EN" "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
  <appender name="HTTP_FILEOUT"
class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="../webapps/dispatch/log/http.log" />
<param name="DatePattern" value="'.'yyyyMMdd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%-d{yy-MM-dd HH:mm:ss} [%p:%l] %n %m%n" />
</layout>
</appender>
<logger additivity="false">
<level value="ERROR" />
<appender-ref ref="HTTP_FILEOUT" />
</logger> -->
<root>

<priority value="ERROR" />
<appender-ref ref="HTTP_FILEOUT" />
</root>
</log4j:configuration>

要怎么修改一下?怎么指定编码呢?

------解决方案--------------------
<appender ...>
<param name="encoding" value="UTF-8" />