I should also point out that the result of allowing XIncludes my end up not 
being very satisfying as it isn't great to have a file that looks like below. 
For one, the file below won't even work because the definitions in the xinclude 
files can't be wrapped in a parent element. Second, the files have to exist 
even if they are empty. Third, it is just very disjointed to have to have 3 
files to include the pieces.


<configuration status="warn" xmlns:xi="http://www.w3.org/2001/XInclude";>
  <properties>
    <property name="filename">target/rolling1/rollingtest.log</property>
    <xi:include href="conf/log4j-xinclude-properties.xml"/>
  </properties>
  <ThresholdFilter level="debug"/>

  <appenders>
    <Console name="STDOUT">
      <PatternLayout pattern="%m%n"/>
    </Console>
    <RollingFile name="RollingFile" fileName="${filename}"
                 
filePattern="target/rolling1/test1-$${date:MM-dd-yyyy}-%i.log.gz">
      <PatternLayout>
        <pattern>%d %p %C{1.} [%t] %m%n</pattern>
      </PatternLayout>
      <SizeBasedTriggeringPolicy size="500" />
    </RollingFile>
    <xi:include href="conf/log4j-xinclude-appenders.xml"/>
  </appenders>

  <loggers>
    <xi:incldue href="conf/log4j-xinclude-loggers.xml"/>
    <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.core.appender.rolling" level="debug" 
additivity="false">
      <appender-ref ref="RollingFile"/>
    </logger>>

    <root level="error">
      <appender-ref ref="STDOUT"/>
    </root>
  </loggers>

</configuration>


On Aug 9, 2013, at 9:44 PM, Ralph Goers wrote:

> Perform a search on XInclude and xml:base and you will find that this problem 
> is not unique to what we are doing. XML Schema processing also fails. Xerces 
> provides a way to disable xml:base but I'm not sure about the native XML 
> parser.
> 
> I will probably just need to modify XMLConfiguration to ignore xml:base or 
> anything that starts with xml:.
> 
> Ralph
> 
> 
> On Aug 9, 2013, at 8:37 PM, Gary Gregory wrote:
> 
>> Hello All:
>> 
>> I've enabled XInclude for XML configurations.
>> 
>> See https://issues.apache.org/jira/browse/LOG4J2-341
>> 
>> The side effect is that the XML configuration incorrectly complains:
>> 
>> 2013-08-09 23:33:16,085 ERROR appenders contains an invalid element or 
>> attribute "xml:base"
>> 2013-08-09 23:33:16,090 ERROR loggers contains an invalid element or 
>> attribute "xml:base"
>> 
>> The "xml:base" attribute is part of the XML standards used by XInclude.
>> 
>> This seems to be due to the deeply custom XML processing (as opposed to 
>> using JAXB for example) we implement.
>> 
>> Any ideas on fixing this issue and others of the same type this might 
>> exemplify?
>> 
>> I wonder of Simone's alternate configuration model would suffer from this 
>> issue?
>> 
>> Thank you,
>> Gary
> 

Reply via email to