Skip to content

Published log4j-config-2.xsd rejects additivity on <Logger> #4475

Open

Description

@fcorneli

Expected: <Logger name="..." additivity="false"> validates against https://logging.apache.org/xml/ns/log4j-config-2.xsd, as documented in the manual.
Actual: validation fails with "The attribute 'additivity' is not allowed"; <Root additivity="..."> validates.
Affects: the published schema only. Log4j 2.25.5 and 2.26.1 load the configuration and apply additivity="false".
Reproducer: xmllint --noout --schema log4j-config-2.xsd log4j2.xml with the configuration below.

Original report:

When validating the log4j2.xml against the XML schema at:
https://logging.apache.org/xml/ns/log4j-config-2.xsd
the additivity attribute is located only on the Root, not on the Logger.
Hence XML schema validation fails on for example:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN"
               xmlns="https://logging.apache.org/xml/ns"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-config-2.xsd">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%highlight{%-5level} [%logger{1}] %msg%n"/>
        </Console>
    </Appenders>
    <Loggers>
        <Logger name="my.package.here" level="DEBUG" additivity="false">
            <AppenderRef ref="Console"/>
        </Logger>
        <Logger name="another.package.here" level="DEBUG" additivity="false">
            <AppenderRef ref="Console"/>
        </Logger>
        <Root level="WARN">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>

Could this get fixed?

Activity

  1. ramanathan1504 commented on Nov 14, 2026

    @ramanathan1504
    Contributor

    Thanks for the report. Log4j applies additivity on <Logger> correctly. Only the published schema leaves it out, the same gap as #3313 and apache/logging-log4j-tools#135.
    The schema generator skipped boxed attributes such as Boolean additivity. That is fixed in apache/logging-log4j-tools#190 but not released yet, so log4j-config-2.xsd still needs a regenerate and republish.
    The same republish adds other missing attributes, such as useRawMsg on RegexFilter and most of SocketOptions. Keeping this open until the new schema is published.
    @ppkarwasz, is a log4j-docgen release planned, so log4j-config-2.xsd can be regenerated? #2997 part b can close with this one then.

  2. changed the title [-]additivity attribute[/-] [+]Published `log4j-config-2.xsd` rejects `additivity` on `<Logger>`[/+] on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions