<br><br><div class="gmail_quote">On Fri, Nov 20, 2009 at 7:44 PM, Thorbjoern Ravn Andersen <span dir="ltr">&lt;<a href="mailto:ravn@runjva.com">ravn@runjva.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Maarten Bosteels skrev:<div class="im"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
    XMLEncoder will have a severe impact on performance, I&#39;ve tested<br>
    this extensively.<br>
    Have a look at<br>
    <a href="http://sourceforge.net/apps/trac/lilith/wiki/SerializationPerformance" target="_blank">http://sourceforge.net/apps/trac/lilith/wiki/SerializationPerformance</a><br>
    In my testcases, XMLEncoder serialized 300 events while a protobuf<br>
    serializer managed to handle nearly 10.000!<br>
    I&#39;d therefore suggest that you take a mixed approach. Using<br>
    protobuf to serialize the events to a file and writing an<br>
    additional converter to convert that files to whatever you&#39;d like<br>
    as XML-Output as needed<br>
<br>
</blockquote>
<br></div>
I think I didn&#39;t catch on to that discussion when you had it. Probably because I didn&#39;t understand it enough from a brief skim :)<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    A discussion about such a topic was started here:<br>
    <a href="http://marc.info/?l=logback-dev&amp;m=124905434331308&amp;w=2" target="_blank">http://marc.info/?l=logback-dev&amp;m=124905434331308&amp;w=2</a><br>
    &lt;<a href="http://marc.info/?l=logback-dev&amp;m=124905434331308&amp;w=2" target="_blank">http://marc.info/?l=logback-dev&amp;m=124905434331308&amp;w=2</a>&gt; but I<br>
    completely forgot to file an RFE for it.<br>
    I&#39;ve done just that now, thanks for the reminder!<br>
    <a href="http://jira.qos.ch/browse/LBCORE-128" target="_blank">http://jira.qos.ch/browse/LBCORE-128</a><br>
<br>
<br>
I agree with Joern that XMLEncoder is not really suited when throughput is important to you.<br>
</blockquote></div>
For our purpose these &quot;log this complex object&quot; happen rarely enough that we are willing to accept a penalty here, to get a humanly readable rendering.<div class="im"><br></div></blockquote><div><br>It&#39;s not about logging complex objects. It&#39;s about the number of log events that you can write per second. And the CPU cycles that you waste by generating XML.<br>
 <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
    &gt; My current thoughts is to use a ByteArrayOutputStream and<br>
    generate a String using the UTF-8 decoding. The resulting string<br>
    contains a &lt;?xml ... encoding=&quot;UTF-8&quot;?&gt; which is stripped<br>
    resulting in an XML String containing Unicode chars (instead of<br>
    encoded bytes).<br>
<br>
<br>
What is the difference between &quot;Unicode chars&quot; and &quot;encoded bytes&quot; ?<br>
</blockquote></div>
I am talking about internal representation as char&#39;s and the encoded version which is a stream of bytes (which usually is put raw in a file).<div class="im"><br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Every unicode codepoint has to be encoded somehow, no ? UTF-8 is one way to encode the codepoint (and imho the encoding everyone should use)<br>
<br>
    This can then be flattened to an ASCII version, by converting all<br>
    characters outside 32..127 to their numeric entity (&amp;#1234;), and<br>
    THAT can be safely logged. I guess :)<br>
    &gt;<br>
<br>
<br>
If you want to use XML, then I really don&#39;t see the problem with leaving it in UTF-8 ?<br>
</blockquote></div>
There is absolutely no guarantee that the final destination of the log string will be able to handle UTF-8 encoded strings. How does UTF-8 encoded strings end up looking when written using MacRoman under OS X?</blockquote>
<div><br>IMHO, you should embrace UTF-8 instead of being afraid of it.  Tools that are not able to handle UTF-8 are simply not worth using.<br><br>1)  from <a href="http://www.w3.org/TR/xml11/#charencoding">http://www.w3.org/TR/xml11/#charencoding</a>:   &quot;<a name="charencoding" id="charencoding">All XML processors <em class="rfc2119" title="Keyword in RFC 2119 context">MUST</em> be able to read entities in both
the UTF-8 and UTF-16 encodings.&quot;<br>2)  I don&#39;t know MacRoman but from http://en.wikipedia.org/wiki/Mac_OS_Roman :   &quot;With the release of </a><a href="http://en.wikipedia.org/wiki/Mac_OS_X" title="Mac OS X">Mac OS X</a>, Mac OS Roman was replaced by <a href="http://en.wikipedia.org/wiki/UTF-8" title="UTF-8">UTF-8</a> as the standard character encoding for the Macintosh operating system.<a name="charencoding" id="charencoding">&quot;<br>
<br>regards,<br>Maarten<br><br><br></a></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Especially since you state that &quot;a humanly readable transport format will be preferred.&quot; I would prefer to see Σ instead of &amp;#931;<br>
<br>
Of course, it should be possible to tell the XMLEncoder which encoding to use (instead of using the default encoding of the platform).<br>
<br>
</blockquote></div>
XMLEncoder does not have the encoding public. Bah :)<div class="im"><br>
<br>
-- <br>
 Thorbjørn Ravn Andersen  &quot;...plus... Tubular Bells!&quot;<br>
<br>
_______________________________________________<br></div><div><div></div><div class="h5">
user mailing list<br>
<a href="mailto:user@slf4j.org" target="_blank">user@slf4j.org</a><br>
<a href="http://www.slf4j.org/mailman/listinfo/user" target="_blank">http://www.slf4j.org/mailman/listinfo/user</a></div></div></blockquote></div><br>