You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Christoph Lembeck (JIRA)" <ji...@apache.org> on 2017/07/20 10:53:00 UTC
[jira] [Created] (LOG4J2-1982) log24-config.xsd only allows one
AppenderRef element for each Logger element
Christoph Lembeck created LOG4J2-1982:
-----------------------------------------
Summary: log24-config.xsd only allows one AppenderRef element for each Logger element
Key: LOG4J2-1982
URL: https://issues.apache.org/jira/browse/LOG4J2-1982
Project: Log4j 2
Issue Type: Bug
Components: Configurators
Affects Versions: 2.8.2
Environment: Alle environments
Reporter: Christoph Lembeck
The xsd schema definition for the log4j configuration allow only one AppenderRef per Logger. The definition of the Logger element is as follows
{code:xml}
<xs:complexType name="LoggerType">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="1">
<xs:element name="Filters" type="FiltersType"/>
<xs:element name="Filter" type="FilterType"/>
</xs:choice>
<xs:element name="AppenderRef" type="AppenderRefType"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
<xs:attribute name="level" type="xs:string" use="optional"/>
<xs:attribute name="additivity" type="xs:string" use="optional"/>
</xs:complexType>
{code}
Comparing this to the Definition of the root Logger we see a sequence of multiple Appender
Ref elements to be allowed.
{code:xml}
<xs:complexType name="RootType">
<xs:sequence>
<xs:element name="AppenderRef" type="AppenderRefType" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="level" type="xs:string"/>
</xs:complexType>
{code}
With this configuration it is not possible to define a specific Logger, that shows infos and errors to the console and writes only the errors in a log file, since there can only be one appender defined for that logger.
Please modify the xsd file to allow mutliple AppenderRef elements per Logger.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)