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

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1
    • Fix Version/s: 2.2
    • Component/s: Configurators
    • Labels:
      None
    • Environment:

      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

            • Assignee:
              garydgregory Gary Gregory
              Reporter:
              garydgregory Gary Gregory
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: