-
According to https://logging.apache.org/xml/ns/log4j-config-2.23.1.xsd , "additivity" is not allowed in "Logger." This is why I'm receiving a WARN from my IDE. Is this a bug? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @jorge683, Yes, this is indeed a bug — tracked here: apache/logging-log4j-tools#135 — in the Log4j Docgen tool, which we use to generate the XML Schema from source code. It's important to note that Log4j configuration files are inherently schema-less by design. Here’s why:
Because of these limitations, XML validation errors in Log4j configuration files should be taken with a grain of salt — your configuration may be perfectly valid and still trigger schema validation errors. Conversely, a configuration that passes validation might still fail at runtime if the required Log4j Core component JARs are missing. In the long term, we’re considering simplifying the schema generation process to allow users to generate a tailored XML Schema based on the specific Log4j libraries available at runtime. This would improve both the accuracy and usefulness of schema validation in real-world setups. Unfortunately, we currently don't have the bandwidth to implement this, but community contributions to improve Log4j Docgen are always welcome! |
Beta Was this translation helpful? Give feedback.
Hi @jorge683,
Yes, this is indeed a bug — tracked here: apache/logging-log4j-tools#135 — in the Log4j Docgen tool, which we use to generate the XML Schema from source code.
It's important to note that Log4j configuration files are inherently schema-less by design. Here’s why:
Extensibility via Plugins: Log4j Core is highly extensible — all components are implemented as Log4j Plugins. This means users can define custom plugins that the official schema won’t recognize. The published schema only includes plugins maintained by the Apache Logging Services project.
Conditional Configuration with Arbiters: Log4j supports a feature called arbiters, which allows XML elements to be conditionall…