[
https://issues.apache.org/jira/browse/LOG4J2-742?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary Gregory resolved LOG4J2-742.
---------------------------------
Resolution: Fixed
Fix Version/s: 2.0.1
Thank you for the patches! Patches applies with only one minor Javadoc change
to the test class.
{noformat}
commit -m "[LOG4J2-742] XInclude not working with relative path."
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/test/resources/log4j-xinclude.xml
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
C:/vcs/svn/apache/log4j2/trunk-alt/src/changes/changes.xml
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
Sending
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
Adding
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/test/java/org/apache/logging/log4j/core/config/XIncludeTest.java
Sending
C:/vcs/svn/apache/log4j2/trunk-alt/log4j-core/src/test/resources/log4j-xinclude.xml
Sending C:/vcs/svn/apache/log4j2/trunk-alt/src/changes/changes.xml
Transmitting file data ...
Committed revision 1613427.
{noformat}
> XInclude not working with relative path
> ---------------------------------------
>
> Key: LOG4J2-742
> URL: https://issues.apache.org/jira/browse/LOG4J2-742
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Pascal Chollet
> Assignee: Gary Gregory
> Fix For: 2.0.1
>
> Attachments: xinclude-test.patch, xinclude.patch
>
>
> When using XInclude in a log4j2 configuration, it uses the CWD of the running
> application instead of the location of the log4j configuration as base.
> I.e. running the application from within eclipse, the CWD of eclipse is used
> as base for finding the document to be included.
> IMO, the problem is in XmlConfiguration:
> {code}
> final InputStream configStream = configSource.getInputStream();
> try {
> buffer = toByteArray(configStream);
> } finally {
> configStream.close();
> }
> final InputSource source = new InputSource(new
> ByteArrayInputStream(buffer));
> final Document document = newDocumentBuilder().parse(source);
> {code}
> There is no way the DOMParser can know, where the base should be, because it
> is just parsing an InputStream and has no file location.
> The fix would be to add source.setSystemId(configSource.getLocation()) before
> parsing the document.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]