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 "James Hutton (JIRA)" <ji...@apache.org> on 2014/03/31 13:55:15 UTC

[jira] [Commented] (LOG4J2-341) Enable XInclude for XML configurations

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

James Hutton commented on LOG4J2-341:
-------------------------------------

when using xinclude the path is interpreted as relative to the base directory, not the file including the additional configuration.  Classpath protocol is not usuable either.

> Enable XInclude for XML configurations
> --------------------------------------
>
>                 Key: LOG4J2-341
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-341
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Configurators
>         Environment: Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
> Maven home: C:\Java\apache-maven-3.0.5\bin\..
> Java version: 1.7.0_25, vendor: Oracle Corporation
> Java home: C:\Program Files\Java\jdk1.7.0_25\jre
> Default locale: en_US, platform encoding: Cp1252
> OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
>            Reporter: Gary Gregory
>             Fix For: 2.0-beta9
>
>
> Enable XInclude for XML configurations.
> See {{org.apache.logging.log4j.core.config.XMLConfigurationTest}}
> For example:
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <configuration xmlns:xi="http://www.w3.org/2001/XInclude"
>   status="warn" name="XMLConfigTest" packages="org.apache.logging.log4j.test">
>   <properties>
>     <property name="filename">target/test.log</property>
>   </properties>
>   <ThresholdFilter level="debug"/>
>   <xi:include href="target/test-classes/log4j-xinclude-appenders.xml" />
>   <xi:include href="target/test-classes/log4j-xinclude-loggers.xml" />
> </configuration>{code}
> {code:xml|title=log4j-xinclude-appenders.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <appenders>
>   <Console name="STDOUT">
>     <PatternLayout pattern="%m%n" />
>   </Console>
>   <File name="File" fileName="${filename}" bufferedIO="false">
>     <PatternLayout>
>       <pattern>%d %p %C{1.} [%t] %m%n</pattern>
>     </PatternLayout>
>   </File>
>   <List name="List">
>     <filters>
>       <ThresholdFilter level="error" />
>     </filters>
>   </List>
> </appenders>
> {code}
> {code:xml|title=log4j-xinclude-loggers.xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <loggers>
>   <logger name="org.apache.logging.log4j.test1" level="debug" additivity="false">
>     <ThreadContextMapFilter>
>       <KeyValuePair key="test" value="123" />
>     </ThreadContextMapFilter>
>     <appender-ref ref="STDOUT" />
>   </logger>
>   <logger name="org.apache.logging.log4j.test2" level="debug" additivity="false">
>     <appender-ref ref="File" />
>   </logger>
>   <root level="error">
>     <appender-ref ref="STDOUT" />
>   </root>
> </loggers>
> {code}



--
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