log4j编码utf8 [英] log4j encoding utf8

查看:225
本文介绍了log4j编码utf8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Java和Log4j.

I use Java and Log4j..

我想记录一个带有德语特殊字符的字符串,例如ÜÄä等. 但是在我的LogFile中,它看起来像这样:

I want to log a string with german special characters, like for example Ü Ä ä etc.. But in my LogFile it appears like this:

<E4><FC><F6>

log4j.properties

log4j.properties

log4j.rootLogger = ALL, rollingFile

log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=/home/tomcat/logs/debug.log 
log4j.appender.rollingFile.MaxFileSize=10MB
log4j.appender.rollingFile.MaxBackupIndex=2
log4j.appender.rollingFile.layout = org.apache.log4j.PatternLayout
log4j.appender.rollingFile.layout.ConversionPattern=%d %p %c - %m%n
log4j.appender.rollingFile.encoding=UTF-8

推荐答案

根据有关Log4J编码的最常发布的问题,似乎没有任何已知问题,因此,我假设您在打开文件时使用了错误的编码,尝试检查编辑器和系统编码maby,您会发现一个问题.

According to the most posted issues about encoding with Log4J there doesnt seem to be any known issues, therefor i assume you are using a wrong encoding while opening the file, try to check the editor and system encoding maby you will find there an issue.

这篇关于log4j编码utf8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆