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

XML configuration does not report full error message for XInclude parser configuration problems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1
    • 2.2
    • Configurators
    • None

    Description

      XML configuration does not report full error message for XInclude parser configuration problems.

      Logging messages are missing {}s in the message format strings.

      Diff for fix:

      diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
      index 8962443..c094137 100644
      --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
      +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
      @@ -96,27 +96,27 @@
                   // -DLog4j.XInclude=true
                   factory.setXIncludeAware(true);
               } catch (final UnsupportedOperationException e) {
      -            LOGGER.warn("The DocumentBuilderFactory does not support XInclude: {}", factory, e);
      +            LOGGER.warn("The DocumentBuilderFactory [{}] does not support XInclude: {}", factory, e);
               } catch (@SuppressWarnings("ErrorNotRethrown") final AbstractMethodError err) {
      -            LOGGER.warn("The DocumentBuilderFactory is out of date and does not support XInclude: {}", factory, err);
      +            LOGGER.warn("The DocumentBuilderFactory [{}] is out of date and does not support XInclude: {}", factory, err);
               }
               try {
                   // Alternative: We could specify all features and values with system properties like:
                   // -DLog4j.DocumentBuilderFactory.Feature="http://apache.org/xml/features/xinclude/fixup-base-uris true"
                   factory.setFeature(XINCLUDE_FIXUP_BASE_URIS, true);
               } catch (final ParserConfigurationException e) {
      -            LOGGER.warn("The DocumentBuilderFactory [{}] does not support the feature [{}].", factory,
      +            LOGGER.warn("The DocumentBuilderFactory [{}] does not support the feature [{}]: {}", factory,
                           XINCLUDE_FIXUP_BASE_URIS, e);
               } catch (@SuppressWarnings("ErrorNotRethrown") final AbstractMethodError err) {
      -            LOGGER.warn("The DocumentBuilderFactory is out of date and does not support setFeature: {}", factory, err);
      +            LOGGER.warn("The DocumentBuilderFactory [{}] is out of date and does not support setFeature: {}", factory, err);
               }
               try {
                   factory.setFeature(XINCLUDE_FIXUP_LANGUAGE, true);
               } catch (final ParserConfigurationException e) {
      -            LOGGER.warn("The DocumentBuilderFactory [{}] does not support the feature [{}].", factory,
      +            LOGGER.warn("The DocumentBuilderFactory [{}] does not support the feature [{}]: {}", factory,
                           XINCLUDE_FIXUP_LANGUAGE, e);
               } catch (@SuppressWarnings("ErrorNotRethrown") final AbstractMethodError err) {
      -            LOGGER.warn("The DocumentBuilderFactory is out of date and does not support setFeature: {}", factory, err);
      +            LOGGER.warn("The DocumentBuilderFactory [{}] is out of date and does not support setFeature: {}", factory, err);
               }
           }
       

      Attachments

        Activity

          People

            ggregory Gary D. Gregory
            ggregory Gary D. Gregory
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: