log4j2 文件附加程序对文件 encoding/format 使用什么?
What does log4j2 file appenders use for file encoding/format?
log4j2写入rollingfileappender时使用什么文件格式?此外,有没有办法改变它?我想做的是使用 UTF-16。
The Charset is specified on the Layout. AbstractStringLayout
defaults to UTF-8.
您应该可以通过在布局配置中指定 charset="UTF-16"
来更改它。
对 Ralph 回答的小修正:对于 PatternLayout,默认字符集是系统默认值。这很重要,因为例如 Windows 控制台将无法在日语 Windows 上正确显示 UTF-8。
如果使用log4j.properties,配置如下:
appender.rolling.layout.charset = UTF-16
或者在你的xml配置文件中进行相应的配置。
log4j2写入rollingfileappender时使用什么文件格式?此外,有没有办法改变它?我想做的是使用 UTF-16。
The Charset is specified on the Layout. AbstractStringLayout
defaults to UTF-8.
您应该可以通过在布局配置中指定 charset="UTF-16"
来更改它。
对 Ralph 回答的小修正:对于 PatternLayout,默认字符集是系统默认值。这很重要,因为例如 Windows 控制台将无法在日语 Windows 上正确显示 UTF-8。
如果使用log4j.properties,配置如下:
appender.rolling.layout.charset = UTF-16
或者在你的xml配置文件中进行相应的配置。