[ 
https://issues.apache.org/jira/browse/LOG4J2-2283?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524591#comment-16524591
 ] 

Ralph Goers commented on LOG4J2-2283:
-------------------------------------

Gary, I've seen this kind of thing before. Once the XML parser decides to throw 
an exception it is done. It flags itself as having had an error and refuses to 
do any more. Since this in an Oracle package it is highly unlikely the source 
is available so it is difficult for us to know what the exact problem is. In 
fact, all the Javadoc I can find online for this class says it doesn't even 
have a setFeature method, yet it is showing up in the stack trace so it 
obviously does. More than likely it just doesn't like the feature being set.

To really handle this error we would have to throw the exception all the way 
back to the init method where a new DocumentBuilder would have to be 
constructed that does not attempt to set this feature.

Given that XML processing is clearly borked here a workaround would be to 
convert log4j2.xml to JSON or java properties.

> ParserConfigurationException when using Log4j with 
> oracle.xml.jaxp.JXDocumentBuilderFactory
> -------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2283
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2283
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.10.0
>            Reporter: Vishnu Priya Matha
>            Priority: Major
>             Fix For: 3.0.0, 2.11.1
>
>
> I am using Junit 4.10 and log4j 2.10 versions. When I run the junit test, I 
> am unable to get the logs and following is the error when I turn on the log4j 
> debugging:
> ERROR StatusLogger Error parsing /scratch/log4j.xml
>  javax.xml.parsers.ParserConfigurationException
>  at 
> oracle.xml.jaxp.JXDocumentBuilderFactory.setFeature(JXDocumentBuilderFactory.java:374)
>  at 
> org.apache.logging.log4j.core.config.xml.XmlConfiguration.setFeature(XmlConfiguration.java:213)
>  at 
> org.apache.logging.log4j.core.config.xml.XmlConfiguration.disableDtdProcessing(XmlConfiguration.java:205)
>  at 
> org.apache.logging.log4j.core.config.xml.XmlConfiguration.newDocumentBuilder(XmlConfiguration.java:194)
>  at 
> org.apache.logging.log4j.core.config.xml.XmlConfiguration.<init>(XmlConfiguration.java:92)
>  at 
> org.apache.logging.log4j.core.config.xml.XmlConfigurationFactory.getConfiguration(XmlConfigurationFactory.java:46)
>  at 
> org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:239)
>  at 
> org.apache.logging.log4j.core.config.ConfigurationFactory$Factory.getConfiguration(ConfigurationFactory.java:369)
>  at 
> org.apache.logging.log4j.core.config.ConfigurationFactory.getConfiguration(ConfigurationFactory.java:260)
>  at 
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:613)
>  at 
> org.apache.logging.log4j.core.LoggerContext.setConfigLocation(LoggerContext.java:603)
>  at oracle.oki.service.SampleBaseTest.setUpClass(SampleBaseTest.java:113)
>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>  at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>  at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  at java.lang.reflect.Method.invoke(Method.java:497)
>  at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>  at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>  at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>  at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>  at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
>  at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>  at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>  at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:422)
>  at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
>  at 
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:785)
> Following is how I setup my logging configuration:
> LoggerContext context = (LoggerContext) LogManager.getContext(false);
>  File file = new File("/scratch/log4j.xml");
>  
>  // this will force a reconfiguration
>  context.setConfigLocation(file.toURI());
> And the log4j.xml has following contents:
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration monitorinterval="30" status="info" strict="true">
>  <Properties>
>  <Property name="filename">/scratch/CelsiusConverter.log</Property>
>  </Properties>
>  <Appenders>
>  <Appender type="Console" name="Console">
>  <target>System.err</target>
>  <Layout type="PatternLayout" pattern="%d %p [%t] %m%n" />
>  </Appender>
>  <Appender type="Console" name="FLOW">
>  <target>System.err</target>
>  <Layout type="PatternLayout" pattern="%C\{1}.%M %m %ex%n" />
>  </Appender>
>  <Appender type="File" name="File" fileName="${filename}">
>  <Layout type="PatternLayout" pattern="%d %p %C\{1.} [%t] %m%n" />
>  </Appender>
>  </Appenders>
>  <Loggers>
>  <Root level="trace">
>  <AppenderRef ref="File" />
>  </Root>
>  </Loggers>
> </Configuration>



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to