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 "Ralph Goers (JIRA)" <ji...@apache.org> on 2014/07/24 17:45:39 UTC

[jira] [Commented] (LOG4J2-742) XInclude not working with relative path

    [ https://issues.apache.org/jira/browse/LOG4J2-742?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14073307#comment-14073307 ] 

Ralph Goers commented on LOG4J2-742:
------------------------------------

Would you be able to provide a unit test and a patch for this?

> 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
>
> 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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org