Skip to content

Log4J2: PatternLayout "charset" in documentation but forbidden by xml schema #3423

@palbr

Description

@palbr

Description

I have a config file for Log4j 2.x in XML format:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration 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 charset="UTF-8" pattern="test"/>    <!-- error here -->
        </Console>
    </Appenders>

    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="console"/>
        </Root>
    </Loggers>
</Configuration>

The XML validation is telling me:

Attribute charset is not allowed here

The documentation for Log4j 2.x is telling me that an attribut charset exists in PatternLayout: https://logging.apache.org/log4j/2.x/manual/pattern-layout.html#plugin-attr-charset

Reading the website published at https://logging.apache.org/xml/ns, I get the impression that https://logging.apache.org/xml/ns/log4j-config-2.xsd is the official "configuration file xml schema".

Configuration

Version: Log4j 2.x

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions