You have specified strict=“true” but then not followed the format required when 
that attribute is specified. See the example at 
https://logging.apache.org/log4j/2.x/manual/configuration.html#Configuration_Syntax
 under the sentence that reads "Below is a sample configuration using the 
strict format.”

Note that individual Filters, Appenders, Layouts, etc. can have attributes or 
children that the XML schema doesn’t know anything about and won’t really 
validate.

Ralph



> On Jan 3, 2019, at 6:41 AM, Ed Zappulla <ed.zappu...@bsgsystems.com> wrote:
> 
> I'm having trouble getting my log4j2.xml file to conform to the schema.
> Without the schema specification I don't have any errors but with it in
> place I am getting:
> 
> cvc-complex-type.2.4.d: Invalid content was found starting with element
> 'File'. No child element is expected at 
> 
> this point.
> 
> 
> 
> cvc-complex-type.2.4.d: Invalid content was found starting with element
> 'Logger'. No child element is expected 
> 
> at this point.
> 
> 
> 
> The logging works fine without the schema but Eclipse is warning that its
> missing so I would like to have it in place. This is the log4j2.xml file I'm
> using:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> 
> <Configuration strict="true"
>           xmlns="http://logging.apache.org/log4j/2.0/config";
>           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>           xsi:schemaLocation="http://logging.apache.org/log4j/2.0/config 
> 
> https://raw.githubusercontent.com/apache/logging-log4j2/log4j-2.11.1/log4j-c
> ore/src/main/resources/Log4j-config.xsd">
> 
>  <Appenders>
> 
>    <Console name="console" target="SYSTEM_OUT">
>      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5p %-5level -
> %msg%n"/>
>    </Console>
> 
>    <File name="file" fileName="mylogfile.log" append="true">
>      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss z} %-5p %-5level -
> %msg%n"/>
>    </File >
>  </Appenders>
> 
> 
>  <Loggers>
>    <Root level="DEBUG">
>      <AppenderRef ref="console"/>
>      <AppenderRef ref="file"/>
>    </Root>
> 
>    <Logger name="org.apache.http" level="WARN" additivity="false">
>      <AppenderRef ref="console"/>
>      <AppenderRef ref="file"/>
>    </Logger>
> 
>    <Logger name="net.authorize.util" level="WARN" additivity="false">
>      <AppenderRef ref="console"/>
>      <AppenderRef ref="file"/>
>    </Logger>
> 
>    <Logger name="net.authorize.api" level="WARN" additivity="false">
>      <AppenderRef ref="console"/>
>      <AppenderRef ref="file"/>
>    </Logger>
> 
>  </Loggers>
> 
> </Configuration>
> 
> 
> 
> 
> 
> Any help would be appreciated.
> 
> 
> 
> 
> 
> Thank you
> 
> 
> 
> .ed
> 
> 
> 
> 
> 

Reply via email to