Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>"Logging to XML" is quite a general requirement, because there is no such thing as the standard log file format. But since XML files are text files, which logging frameworks can write, and since many of those frameworks allow configuring log line format, I see no problem in defining your log output with XML tags of choice.</p> <p>For log4j, it might be something like this:</p> <pre><code>log4j.appender.A1.layout.ConversionPattern=&lt;line&gt;%n&lt;date&gt;%d&lt;/date&gt;%n&lt;threadName&gt;%t&lt;/threadName&gt;%n&lt;level&gt;%p&lt;/level&gt;%n&lt;logger&gt;%c&lt;/logger&gt;%n&lt;text&gt;%m&lt;/text&gt;%n&lt;/line&gt;%n </code></pre> <p>yielding example output:</p> <pre><code>&lt;line&gt; &lt;date&gt;2011-08-28 08:27:33,727&lt;/date&gt; &lt;threadName&gt;main&lt;/threadName&gt; &lt;level&gt;INFO&lt;/level&gt; &lt;logger&gt;com.log4jeval.Main&lt;/logger&gt; &lt;text&gt;Entering application.&lt;/text&gt; &lt;/line&gt; </code></pre> <p>This looks quite like XML, doesn't it? It will lack XML preamble, though, so technically it won't be valid. If it's critical that it is, I recommend writing a custom appender extending <code>org.apache.log4j.FileAppender</code> (or any of its subclasses) that would handle any additional opening/closing text in every log file.</p> <p>The problem with writing logs to XML, that does not exist in plain text files, is that you have to enforce that <strong>not one</strong> possible log statement would print XML forbidden characters, otherwise you'll end up with a non well-formed XML. That's hard to achieve without writing a custom appender &mdash; see <code>org.apache.log4j.HTMLAppender</code> sources for example.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload