I configured log4j SMTPAppender to send emails to me on errors. It works, but I have problem with non ASCII data. Configuration uses HTMLLayout and their documentation states:
Appenders using this layout should have their encoding set to UTF-8 or UTF-16, otherwise events containing non ASCII characters could result in corrupted log files.
My log files must contains UTF-8 data, but I can't find where I can set encoding for appender. Here is appender configuration:
<appender name="MAIL" class="org.apache.log4j.net.SMTPAppender">
<param name="BufferSize" value="25" />
<param name="SMTPHost" value="localhost" />
<param name="From" value="[email protected]" />
<param name="Threshold" value="error" />
<param name="To" value="[email protected]" />
<param name="Subject" value="Error Occurred" />
<param name="LocationInfo" value="true"/>
<param name="encoding" value="UTF-8" />
<!-- <param name="Encoding" value="UTF-8"/> -->
<layout class="org.apache.log4j.HTMLLayout">
</layout>
</appender>
When application runs I got:
log4j:WARN No such property [encoding] in org.apache.log4j.net.SMTPAppender