What file format does log4j2 use when it writes to rollingfileappender? Furthermore, is there a way to change it? What I'd like to do use use UTF-16.
The Charset is specified on the Layout. AbstractStringLayout
defaults to UTF-8.
You should be able to change that by specifying charset="UTF-16"
on the Layout configuration.
If you use log4j.properties, configure it as follow:
appender.rolling.layout.charset = UTF-16
or make the corresponding configurations in your xml configuration file.
Small correction on Ralph's answer: for PatternLayout the default charset is the system default. This is important because for example the Windows console won't be able to correctly display UTF-8 on Japanese Windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With