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

Roger Lee edited comment on LOG4J2-2283 at 6/27/18 2:13 AM:
------------------------------------------------------------

I'm away from the client's machine where the error is occurring now. I 
implemented Log4j2 2.11.0 in IntelliJ on MacOS and Unit tests to test that the 
various log levels are called. Using a custom Appender I get the number of 
messages retrieved for each of the LEVELS when various logging levels are set. 
So six for ALL (TRACE, DEBUG. INFO, WARN, ERROR, FATAL) and two for WARN etc. 
All the unit tests with 2.11.0 on MacOS pass. Probably due to no version of the 
oracle.xml.jaxp.JXDocumentBuilderFactory being present.

When the code was pulled onto the Windows PC with log4j2 2.11, which has 
Oracle's WebLogic 12 installed I'm getting:

{{Error parsing 
C:\Users\rogerl\IdeaProjects\networkrail_screens_clone\screens-war\build\resources\main\log4j2.xml}}
 {{javax.xml.parsers.ParserConfigurationException}}

And all the Unit Tests fail - as the number of messages retrieved for each 
LEVEL is zero.

I've tried with both 2.11.1-SNAPSHOT and 3.0.0-SNAPSHOT.

 


was (Author: notify):
I'm away from the client's machine where the error is occurring now. I 
implemented Log4j2 2.11.0 in IntelliJ on MacOS and Unit tests to test that the 
various log levels are called. Using a custom Appender I get the number of 
messages retrieved for each of the LEVELS when various logging levels are set. 
So six for ALL (TRACE, DEBUG. INFO, WARN, ERROR, FATAL) and two for WARN etc. 
All the unit tests with 2.11.0 on MacOS pass. Probably due to no version of the 
oracle.xml.jaxp.JXDocumentBuilderFactory being present.

When pulled the code onto the Windows PC with log4j2 2.11, which has Oracle's 
WebLogic 12 installed I'm getting:

{{Error parsing 
C:\Users\rogerl\IdeaProjects\networkrail_screens_clone\screens-war\build\resources\main\log4j2.xml}}
 {{javax.xml.parsers.ParserConfigurationException}}

I've tried with 2.11.1-SNAPSHOT and 3.0.0-SNAPSHOT in my Gradle build and the 
exception is thrown and all the Unit Tests fail - as the number of messages 
retrieved for each LEVEL is zero.

 

> 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