You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Spies, Brennan" <Br...@ejgallo.com> on 2007/01/11 20:30:25 UTC

[log4j] Question about XMLLayout

Hi all,

 

I want to use a file appender that uses XMLLayout to output an XML file, then
process this XML file with XSLT (Ant's xslt task) during an Ant build
process. The problem is, I am getting an error regarding the "log4j"
namespace coming from the output of XMLLayout-namely that it is not declared
in the document.

 

Is there a way to get XMLLayout to declare this namespace-or simply to
suppress its use of the namespace prefix?

 

 

 

Brennan Spies

Sr. Programmer Analyst


Re: [log4j] Question about XMLLayout

Posted by Curt Arnold <ca...@apache.org>.
On Jan 11, 2007, at 1:30 PM, Spies, Brennan wrote:

> Hi all,
>
>
>
> I want to use a file appender that uses XMLLayout to output an XML  
> file, then
> process this XML file with XSLT (Ant's xslt task) during an Ant build
> process. The problem is, I am getting an error regarding the "log4j"
> namespace coming from the output of XMLLayout-namely that it is not  
> declared
> in the document.
>
>
>
> Is there a way to get XMLLayout to declare this namespace-or simply to
> suppress its use of the namespace prefix?
>
> Brennan Spies
>
> Sr. Programmer Analyst
>

log4j doesn't actually produce an XML document since an XML document  
can only have one element.  log4j produces an XML parsed entity (in  
this case a sequence of elements) that can be referenced in an XML  
document and it is assumed that the containing document would declare  
the namespace prefix.  To process the output of log4j by XSLT, you  
would need to create a small XML document that includes the log file  
and then process the XML document using XSLT.

Your XML document would look like:

<!DOCTYPE mydocument [
<!ENTITY logfile SYSTEM 'logger.xml'>
]>
<mydocument xmlns:log4j='http://jakarta.apache.org/log4j/'>
&logfile;
</mydocument>



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org