zi4k4j74yn opened a new issue, #1456:
URL: https://github.com/apache/logging-log4j2/issues/1456

   ## Description
   
   I am using the example configuration from 
https://logging.apache.org/log4j/2.x/manual/appenders.html#FileAppender and 
just added the schema configuration:
   
   ```
   <?xml version="1.0" encoding="UTF-8"?>
   <Configuration 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/master/log4j-core/src/main/resources/Log4j-config.xsd";
 status="warn" name="MyApp">
     <Appenders>
       <File name="MyFile" fileName="logs/app.log">
         <PatternLayout>
           <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
         </PatternLayout>
       </File>
     </Appenders>
     <Loggers>
       <Root level="error">
         <AppenderRef ref="MyFile"/>
       </Root>
     </Loggers>
   </Configuration>
   ```
   
   This config fails to validate against 
https://raw.githubusercontent.com/apache/logging-log4j2/master/log4j-core/src/main/resources/Log4j-config.xsd
 (error below).
   
   ## Configuration
   
   **Version:** 2.20.0
   
   **Operating system:** Ubuntu 22.04
   
   **JDK:** OpenJDK 20
   
   ## Logs
   
   Message from [xmllint](https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home):
   ```
   log4j2.xml:6: element File: Schemas validity error : Element 
'{http://logging.apache.org/log4j/2.0/config}File': This element is not 
expected. Expected is one of ( 
{http://logging.apache.org/log4j/2.0/config}Appender, 
{http://logging.apache.org/log4j/2.0/config}Console ).
   log4j2.xml fails to validate
   ```
   
   Eclipse gives a similar error:
   
   ```
   cvc-complex-types.2.4.d: Invalid content was found starting with element 
'File'. [...]
   ```
   
   ## Reproduction
   
   Create config file as specified and verify against linked schema (either via 
`xmllint --noout --schema Log4j-config.xsd log4j2.xml` or via Eclipse).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to