Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-1982

Log4j-config.xsd only allows one AppenderRef element for each Logger element

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.2
    • 2.9.0
    • Configurators
    • None
    • Alle environments

    Description

      The xsd schema definition for the log4j configuration allow only one AppenderRef per Logger. The definition of the Logger element is as follows

      <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>
      

      Comparing this to the Definition of the root Logger we see a sequence of multiple Appender
      Ref elements to be allowed.

      <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>
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scotty24 Christoph Lembeck
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: