There were several issues with the log4j XMLLayout that have been addressed in the last few years. It is very likely that these same issues were inherited by log4net.

See the following bugs:

http://issues.apache.org/bugzilla/show_bug.cgi?id=35691
http://issues.apache.org/bugzilla/show_bug.cgi?id=34875
http://issues.apache.org/bugzilla/show_bug.cgi?id=43078

Trying to pre-escape the message to work around the issue with XMLLayout is an undesirable kludge.

Part of the issue is that the architecture tries to split XML serialization half way with a XML document to character string conversion (XMLLayout) and a character string to byte stream (character set encoding) when the right way would be to have a XML document to byte stream converter. Since the XMLLayout may need to escape characters that can not be represented in the current code page. The only consistent way of making sure that the output of XMLLayout is properly rendered is to escape character entities (for example: ۾) but US-ASCII characters.

These changes might be helpful:

svn diff -r311427:HEAD 
http://svn.apache.org/repos/asf/logging/log4j/trunk/src/main/java/org/apache/log4j/xml/XMLLayout.java
svn diff -r311427:HEAD 
http://svn.apache.org/repos/asf/logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/Transform.java

Reply via email to