Log4Net: Logging in 2 byte languages (japanese, chinese etc.)

a 夏天 提交于 2019-11-30 06:35:15

问题


I would like to log data to a file in 2 byte languages (chinese, japanese etc) using log4net.

How to properly configure log4net to do that?


回答1:


The log file encoding is specified by FileAppender.Encoding. It can be configured using the encoding configuration element. Example:

<appender name="FileAppender" type="log4net.Appender.FileAppender">
    <file value="file.log" />
    <encoding value="utf-8" />
    ...

The value is the code page name. The corresponding Encoding is obtained using the System.Text.Encoding.GetEncoding(string) method. For a list of code pages, see the Encoding class documentation.



来源:https://stackoverflow.com/questions/6953424/log4net-logging-in-2-byte-languages-japanese-chinese-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!