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

log4j2.xml cannot be parsed on WebSphere

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.17.2
    • 2.18.0
    • Configurators
    • None

    Description

      Basically similar as LOG4J2-1127

      ERROR StatusLogger Error parsing ..log4j2.xml
      javax.xml.parsers.ParserConfigurationException: Feature 'http://apache.org/xml/features/xinclude' is not recognized.
         at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
         at org.apache.logging.log4j.core.config.xml.XmlConfiguration.newDocumentBuilder(XmlConfiguration.java:193)
         at org.apache.logging.log4j.core.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:91)
         at org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory.getConfiguration(XmlConfigurationFactory.java:46)
         at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:559)
         at org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:483)
         at org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:325)
         at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:690)
         at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
         at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
         at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
         at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
         at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
         at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:599)
         ...
      ERROR StatusLogger No logging configuration   
      

      Current retry does not cover this scenario.

                 final DocumentBuilder documentBuilder = newDocumentBuilder(true);
                  Document document;
                  try {
                      document = documentBuilder.parse(source);
                  } catch (final Exception e) {
                      // LOG4J2-1127
                      final Throwable throwable = Throwables.getRootCause(e);
                      if (throwable instanceof UnsupportedOperationException) {
                          LOGGER.warn(
                                  "The DocumentBuilder {} does not support an operation: {}."
                                  + "Trying again without XInclude...",
                                  documentBuilder, e);
                          document = newDocumentBuilder(false).parse(source);
                      } else {
                          throw e;
                      }
                  }
      

      Attachments

        Issue Links

          Activity

            People

              pkarwasz Piotr Karwasz
              simonikula Simo Nikula
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: