logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Schwarzenbach <subscri...@blackbrook.org>
Subject Re: Lohg4j2 Schema Errors
Date Thu, 03 Jan 2019 22:54:41 GMT
I'm not up on what the state of the log4j config schema is (though I've 
seen things in the past about it not being able to model what can 
actually be in a config, but these may have been addressed) but by 
looking at that xsd, it looks like it wants the Console element to 
appear *after* all of the other Appender elements. However even fixing 
that, I can't see how your config xml (or mine for that matter) would 
validate since that xsd doesn't define the specific appender elements 
like File or RollingFile*. *

I could imagine these elements might be meant to be defined by other xsd 
files. It is possible to specify multiple xsd files in an xml file, all 
of which could be necessary to validate it. (This isn't very commonly 
done, but might be a desirable way to do it if various appenders were 
condered extensions that the core schema should not "know" about.) So it 
might be worth trying to find if there are additional xsd files...



On 1/3/19 8:41 AM, Ed Zappulla 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
>
>   
>
>   
>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message