You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2007/06/09 02:13:13 UTC

DO NOT REPLY [Bug 42623] New: - log4j.dtd does not parse when xml namespaces are enabled

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42623>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42623

           Summary: log4j.dtd does not parse when xml namespaces are enabled
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: john.cameron@orcsoftware.com


We cannot use log4j in applications where XML namespaces need to be enabled.

The exception as shown below is thrown.

While there may be ways of changing the application to code around this (eg by
having multiple DocumentBuilderFactory's) this is very inconvenient.

The problem is the use of the colon (:) in the name "log4j:configuration" in the
 log4j.dtd file. It would be preferable to use underscore or some other character.

Sample exception:

ERROR configuration.ConfigurationInXml: load() Exceptionjava.lang.Exception:
Problem parsing XML: org.xml.sax.SAXParseException: A colon is not allowed in
the name 'log4j:configuration' when namespaces are enabled.
java.lang.Exception: Problem parsing XML: org.xml.sax.SAXParseException: A colon
is not allowed in the name 'log4j:configuration' when namespaces are enabled.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42623] - log4j.dtd does not parse when xml namespaces are enabled

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42623>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42623


carnold@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From carnold@apache.org  2007-06-08 18:00 -------
Quite a few things seem a little odd.  First, I'll acknowledge that the use of namespaces in the log4j 
configuration is atypical, but that predates my involvement with log4j.  At this point in the lifecycle of 
log4j 1.2, changing the configuration file format is not an option.

You mention than an exception is thrown.  Any non-fatal errors detected by the XML parser on a call to 
DOMConfigure.configure() should result in a message to the console but would not stop processing 
(see org.apache.log4j.xml.SAXErrorHandler and the catch block in 
o.a.l.xml.DOMConfigurator.doConfigure(ParseAction...).  If the parser was either correctly or incorrectly 
identifying a validation error, log4j should ignore it and continues processing.

Your sample output suggests that it is coming from some code other than log4j reading a log4j 
configuration file.  I see no place in the log4j code where "ConfigurationInXml" appears.

There are several XML parsers that could be used and they can slightly vary in their interpretation of the 
XML recommendations, particularly in atypical cases.  If you could identify the parser in use that would 
be very helpful if it is a parser bug.  The value returned by DocumentBuilderFactory.newInstance
().getClass().toString() would probably be enough to at least identify the parser family.

To take this further, I think we need to see an sample app including your configuration file, a 
description of your expected and actual behavior, and the JVM (vendor, version and platform).  Please 
be clear whether the log4j method is raising an exception to the caller or if an exception is raised and 
caught within log4j.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


DO NOT REPLY [Bug 42623] - log4j.dtd does not parse when xml namespaces are enabled

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=42623>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=42623


john.cameron@orcsoftware.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From john.cameron@orcsoftware.com  2007-06-08 18:53 -------
Thanks for the quick response.

We have our own configuration XML for our product, which can optionally contain
Log4J configuration information. We validate all configuration using DTD files,
and include the log4j.dtd for validating the log4j part of the configuration.
If configuration does not validate, we abort processing (with an appropriate
error message).

If it is not an option to change configuration file format (which I understand)
I don't think that there is anything that can be done. So I am happy to close
the issue.
I thought it was worth raising because some time in the future it would
obviously make a lot of sense to adopt the standard way of doing namespaces in XML.

By the way, the parser was xalan-j_2_7_0 and Java 1.4, running on Windows XP.
However, I suspect the same error would be generated using later versions of
Java under different OS's.

Thanks again for your quick response.



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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