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 Philippe Waltregny <ph...@nrb.be> on 2004/07/30 10:40:05 UTC
XMLLayout
Hello,
Sorry to bother you but is anybody able to help me?
I'm trying to use log4j's XMLLayout.
Here are my source codes:
1) log4j-events file
<log4j:event logger="java.logging.log4j.Test" timestamp="1089795669140"
level="DEBUG" thread="main">
<log4j:message><![CDATA[Hello World!]]></log4j:message>
<log4j:locationInfo class="java.logging.log4j.Test" method="execute"
file="Test.java" line="36"/>
</log4j:event>
<log4j:event logger="java.logging.log4j.Test" timestamp="1089795697406"
level="DEBUG" thread="main">
<log4j:message><![CDATA[Hello World!]]></log4j:message>
<log4j:locationInfo class="java.logging.log4j.Test" method="execute"
file="Test.java" line="36"/>
</log4j:event>
2) log4j.xml file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE log4j:eventSet SYSTEM "log4j.dtd"
[
<!ENTITY logEntity SYSTEM "log4j-events">
]>
<log4j:eventSet
version="1.2"
xmlns:log4j="http://jakarta.apache.org/log4j/";>
&logEntity;
</log4j:eventSet>
Here is the result when I open the log4j.xml file in Microsoft Internet Explorer
6.0:
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then
click the Refresh button, or try again later.
--------------------------------------------------------------------------------
Reference to undeclared namespace prefix: 'log4j'. Error processing resource
'file:///C:/java/logging/log4j/log/log4j-events.xml'. Line 1, Position 108
<log4j:event logger="java.logging.log4j.Test" timestamp="1089795669140"
level="DEBUG" thread="main">
Would you please tell me what's wrong?
Thank you.
Philippe
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: XMLLayout
Posted by Rob Gregory <ro...@rosesgroup.co.uk>.
You can't see the output in I.E. as the output from the Log4j XMLLayout is not
valid xml - Log4j omits the XML declaration and the default root node
(including namespace declaration) if you check the source this is to allow the
layout to be used with other appenders etc, but either way you will need to
include the output into a valid XML document.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org