You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Volkan Yazıcı <vo...@gmail.com> on 2021/04/07 07:06:34 UTC

JsonTemplateLayout failures after Java 11 upgrade (Was: Running "master" tests in IntelliJ IDEA after Java 11 upgrade)

Thanks so much for putting time into this Ralph, I really appreciated it.
There is no way I could have figured this out by myself. I have some
questions regarding pom.xml of JTL:

In manifestEntries of JTL pom.xml, shouldn't there be an
Automatic-Module-Name entry?

There are X-Compile-Source-JDK and X-Compile-Target-JDK manifestEntries in
pom.xml. I was expecting something like X-Compile-Release-JDK exposing
maven.compiler.release property. Isn't there such a thing?

On Wed, Apr 7, 2021 at 7:29 AM Ralph Goers <ra...@dslextreme.com>
wrote:

> I have found the problem with the master branch and fixed it.  As I
> suspected I thought I had previously fixed this but I am not sure what
> happened to it.
>
> The issue was simple. Log4j-layout-template-json generates plugins in both
> the public jar and in its tests. However, it was using the same Java
> package for both resulting in duplicate Log4jPlugins classes on the class
> path. Only one of them could be loaded. I fixed the problem by modifying
> the compiler plugin to specify the package to use for the test plugins.
>
> We are still getting a few errors in both the GitHub Actions and Jenkins,
> but those are probably legitimate issues that existed prior to the changes.
>
> One test that keeps failing on GitHub is the SimplePerfTest. It simply
> tries to calculate the time it takes to perform isDebugEnabled,
> isEnabled(Level.DEBUG) and logger.debug where all are false. Normally these
> values are very small and consistent with each other. But in GitHb
> sometimes one or two of the tests will be double or triple what it is
> normally, which will cause the test to fail its limit check. I suspect this
> is purely an environmental issue and will probably just look for a way to
> disable that test on GitHub. I’ve never seen the issue on Jenkins.
>
> Ralph
>
> > On Apr 6, 2021, at 4:49 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> >
> > There was one test I saw saying it couldn’t find the ListAppender. So I
> ran that test with -X and -Dlog4j2.debug=true and got
> >
> > DEBUG StatusLogger Returning AppenderRef with parent root of type
> AppenderRef:class org.apache.logging.log4j.core.config.AppenderRef
> > DEBUG StatusLogger Returning root with parent loggers of type root:class
> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger
> > DEBUG StatusLogger Returning loggers with parent root of type
> loggers:class org.apache.logging.log4j.core.config.LoggersPlugin
> > DEBUG StatusLogger Completed parsing configuration
> > ERROR StatusLogger Error processing element JsonTemplateLayout:
> CLASS_NOT_FOUND
> > ERROR StatusLogger Unable to locate plugin type for JsonTemplateLayout
> > DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
> > ERROR StatusLogger Unable to locate plugin for
> eventTemplateAdditionalField
> > ERROR StatusLogger Unable to locate plugin for
> eventTemplateAdditionalField
> > ERROR StatusLogger Unable to locate plugin for
> eventTemplateAdditionalField
> > ERROR StatusLogger Unable to locate plugin for
> eventTemplateAdditionalField
> > ERROR StatusLogger Unable to locate plugin for JsonTemplateLayout
> > DEBUG StatusLogger Building Plugin[name=appender,
> class=org.apache.logging.log4j.test.appender.ListAppender].
> > TRACE StatusLogger TypeConverterRegistry initializing.
> > DEBUG StatusLogger PluginManager 'TypeConverter' found 26 plugins
> > ERROR StatusLogger Could not create plugin of type class
> org.apache.logging.log4j.test.appender.ListAppender for element List
> > java.lang.NullPointerException
> >       at
> org.apache.logging.log4j.plugins.inject.PluginElementInjector.isRequestedNode(PluginElementInjector.java:94)
> >       at
> java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
> >       at
> java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632)
> >       at
> java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
> >       at
> java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
> >       at
> java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
> >       at
> java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
> >       at
> java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
> >       at
> java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> >       at
> java.base/java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:548)
> >       at
> org.apache.logging.log4j.plugins.inject.PluginElementInjector.inject(PluginElementInjector.java:79)
> >       at
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.lambda$injectBuilder$1(PluginBuilder.java:204)
> >       at java.base/java.util.Optional.ifPresent(Optional.java:183)
> >       at
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectBuilder(PluginBuilder.java:192)
> >       at
> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:126)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:995)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:935)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:927)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:545)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:242)
> >       at
> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:289)
> >       at
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
> >
> >
> > There is obviously lots wrong here. I’ll keep looking into this.
> >
> > Ralph
> >
> >> On Apr 6, 2021, at 4:16 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> >>
> >> I deleted the files from my local repo and restarted the build. It is
> running along just fine - at least until it hits json template layout.
> >>
> >> Is there a reason you use the maven wrapper instead of Maven itself? I
> have never used the wrapper. I am wondering if there is something going on
> there.
> >>
> >> Ralph
> >>
> >>> On Apr 6, 2021, at 4:10 PM, Ralph Goers <ra...@dslextreme.com>
> wrote:
> >>>
> >>> I’ve never seen that. What is maven-annotations-production:log4j-api?
> >>>
> >>> Let me try removing the files from my maven local repo as you did.
> >>>
> >>> Ralph
> >>>
> >>>> On Apr 6, 2021, at 1:14 PM, Volkan Yazıcı <vo...@gmail.com>
> wrote:
> >>>>
> >>>> As subject hints, I am not able to run tests in IDEA anymore after
> Java 11
> >>>> upgrade. I have deleted all IDEA related files and issued a clean
> Maven
> >>>> build:
> >>>>
> >>>> $ rm -rf ./.idea ./**/*.iml
> >>>> $ rm -rf ~/.m2/repository/org/apache/logging/log4j/*/3*-SNAPSHOT
> >>>> $ ./mvnw clean install -DskipTests=true
> >>>>
> >>>> Opened the directory using IDEA (2021.1 RC), but couldn't get it to
> have
> >>>> successful build:
> >>>>
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-core/target/generated-sources/annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-test-sources/test-annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-test-sources/test-annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-sources/annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-sources/annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-layout-jackson-json/target/generated-sources/annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>> W: Output path
> >>>>
> /home/vy/Projects/log4j/3/log4j-core/target/generated-test-sources/test-annotations
> >>>> intersects with a source root. Only files that were created by build
> will
> >>>> be cleaned
> >>>>
> >>>> *E: Cannot build maven-annotations-production:log4j-api because it is
> >>>> included into a circular dependency (module 'log4j-api' production,
> >>>> maven-annotations-production:log4j-api, module 'log4j-plugins'
> production,
> >>>> maven-annotations-production:log4j-plugins)E: Cannot build
> >>>> maven-annotations-test:log4j-plugins because it is included into a
> circular
> >>>> dependency (maven-annotations-test:log4j-plugins, module 'log4j-api'
> tests,
> >>>> maven-annotations-test:log4j-api, module 'log4j-plugins' tests)*
> >>>>
> >>>> Did you get it working? What shall I do to make it work?
> >>>
> >>>
> >>>
> >>
> >>
> >>
> >
> >
> >
>
>
>

Re: JsonTemplateLayout failures after Java 11 upgrade (Was: Running "master" tests in IntelliJ IDEA after Java 11 upgrade)

Posted by Ralph Goers <ra...@dslextreme.com>.
I will check the manifest. The automatic module name doesn’t matter for now as I plan to convert everything that can and should be into “real” JPMS modules before 3.0 is released.

Ralph

> On Apr 7, 2021, at 12:06 AM, Volkan Yazıcı <vo...@gmail.com> wrote:
> 
> Thanks so much for putting time into this Ralph, I really appreciated it.
> There is no way I could have figured this out by myself. I have some
> questions regarding pom.xml of JTL:
> 
> In manifestEntries of JTL pom.xml, shouldn't there be an
> Automatic-Module-Name entry?
> 
> There are X-Compile-Source-JDK and X-Compile-Target-JDK manifestEntries in
> pom.xml. I was expecting something like X-Compile-Release-JDK exposing
> maven.compiler.release property. Isn't there such a thing?
> 
> On Wed, Apr 7, 2021 at 7:29 AM Ralph Goers <ra...@dslextreme.com>
> wrote:
> 
>> I have found the problem with the master branch and fixed it.  As I
>> suspected I thought I had previously fixed this but I am not sure what
>> happened to it.
>> 
>> The issue was simple. Log4j-layout-template-json generates plugins in both
>> the public jar and in its tests. However, it was using the same Java
>> package for both resulting in duplicate Log4jPlugins classes on the class
>> path. Only one of them could be loaded. I fixed the problem by modifying
>> the compiler plugin to specify the package to use for the test plugins.
>> 
>> We are still getting a few errors in both the GitHub Actions and Jenkins,
>> but those are probably legitimate issues that existed prior to the changes.
>> 
>> One test that keeps failing on GitHub is the SimplePerfTest. It simply
>> tries to calculate the time it takes to perform isDebugEnabled,
>> isEnabled(Level.DEBUG) and logger.debug where all are false. Normally these
>> values are very small and consistent with each other. But in GitHb
>> sometimes one or two of the tests will be double or triple what it is
>> normally, which will cause the test to fail its limit check. I suspect this
>> is purely an environmental issue and will probably just look for a way to
>> disable that test on GitHub. I’ve never seen the issue on Jenkins.
>> 
>> Ralph
>> 
>>> On Apr 6, 2021, at 4:49 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>> 
>>> There was one test I saw saying it couldn’t find the ListAppender. So I
>> ran that test with -X and -Dlog4j2.debug=true and got
>>> 
>>> DEBUG StatusLogger Returning AppenderRef with parent root of type
>> AppenderRef:class org.apache.logging.log4j.core.config.AppenderRef
>>> DEBUG StatusLogger Returning root with parent loggers of type root:class
>> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger
>>> DEBUG StatusLogger Returning loggers with parent root of type
>> loggers:class org.apache.logging.log4j.core.config.LoggersPlugin
>>> DEBUG StatusLogger Completed parsing configuration
>>> ERROR StatusLogger Error processing element JsonTemplateLayout:
>> CLASS_NOT_FOUND
>>> ERROR StatusLogger Unable to locate plugin type for JsonTemplateLayout
>>> DEBUG StatusLogger PluginManager 'Lookup' found 16 plugins
>>> ERROR StatusLogger Unable to locate plugin for
>> eventTemplateAdditionalField
>>> ERROR StatusLogger Unable to locate plugin for
>> eventTemplateAdditionalField
>>> ERROR StatusLogger Unable to locate plugin for
>> eventTemplateAdditionalField
>>> ERROR StatusLogger Unable to locate plugin for
>> eventTemplateAdditionalField
>>> ERROR StatusLogger Unable to locate plugin for JsonTemplateLayout
>>> DEBUG StatusLogger Building Plugin[name=appender,
>> class=org.apache.logging.log4j.test.appender.ListAppender].
>>> TRACE StatusLogger TypeConverterRegistry initializing.
>>> DEBUG StatusLogger PluginManager 'TypeConverter' found 26 plugins
>>> ERROR StatusLogger Could not create plugin of type class
>> org.apache.logging.log4j.test.appender.ListAppender for element List
>>> java.lang.NullPointerException
>>>      at
>> org.apache.logging.log4j.plugins.inject.PluginElementInjector.isRequestedNode(PluginElementInjector.java:94)
>>>      at
>> java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
>>>      at
>> java.base/java.util.ArrayList$ArrayListSpliterator.tryAdvance(ArrayList.java:1632)
>>>      at
>> java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
>>>      at
>> java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
>>>      at
>> java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
>>>      at
>> java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
>>>      at
>> java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
>>>      at
>> java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
>>>      at
>> java.base/java.util.stream.ReferencePipeline.findAny(ReferencePipeline.java:548)
>>>      at
>> org.apache.logging.log4j.plugins.inject.PluginElementInjector.inject(PluginElementInjector.java:79)
>>>      at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.lambda$injectBuilder$1(PluginBuilder.java:204)
>>>      at java.base/java.util.Optional.ifPresent(Optional.java:183)
>>>      at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectBuilder(PluginBuilder.java:192)
>>>      at
>> org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:126)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:995)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:935)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:927)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:545)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:242)
>>>      at
>> org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:289)
>>>      at
>> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
>>> 
>>> 
>>> There is obviously lots wrong here. I’ll keep looking into this.
>>> 
>>> Ralph
>>> 
>>>> On Apr 6, 2021, at 4:16 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>>> 
>>>> I deleted the files from my local repo and restarted the build. It is
>> running along just fine - at least until it hits json template layout.
>>>> 
>>>> Is there a reason you use the maven wrapper instead of Maven itself? I
>> have never used the wrapper. I am wondering if there is something going on
>> there.
>>>> 
>>>> Ralph
>>>> 
>>>>> On Apr 6, 2021, at 4:10 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>>>> 
>>>>> I’ve never seen that. What is maven-annotations-production:log4j-api?
>>>>> 
>>>>> Let me try removing the files from my maven local repo as you did.
>>>>> 
>>>>> Ralph
>>>>> 
>>>>>> On Apr 6, 2021, at 1:14 PM, Volkan Yazıcı <vo...@gmail.com>
>> wrote:
>>>>>> 
>>>>>> As subject hints, I am not able to run tests in IDEA anymore after
>> Java 11
>>>>>> upgrade. I have deleted all IDEA related files and issued a clean
>> Maven
>>>>>> build:
>>>>>> 
>>>>>> $ rm -rf ./.idea ./**/*.iml
>>>>>> $ rm -rf ~/.m2/repository/org/apache/logging/log4j/*/3*-SNAPSHOT
>>>>>> $ ./mvnw clean install -DskipTests=true
>>>>>> 
>>>>>> Opened the directory using IDEA (2021.1 RC), but couldn't get it to
>> have
>>>>>> successful build:
>>>>>> 
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-core/target/generated-sources/annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-test-sources/test-annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-test-sources/test-annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-plugins/target/generated-sources/annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-layout-template-json/target/generated-sources/annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-layout-jackson-json/target/generated-sources/annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> W: Output path
>>>>>> 
>> /home/vy/Projects/log4j/3/log4j-core/target/generated-test-sources/test-annotations
>>>>>> intersects with a source root. Only files that were created by build
>> will
>>>>>> be cleaned
>>>>>> 
>>>>>> *E: Cannot build maven-annotations-production:log4j-api because it is
>>>>>> included into a circular dependency (module 'log4j-api' production,
>>>>>> maven-annotations-production:log4j-api, module 'log4j-plugins'
>> production,
>>>>>> maven-annotations-production:log4j-plugins)E: Cannot build
>>>>>> maven-annotations-test:log4j-plugins because it is included into a
>> circular
>>>>>> dependency (maven-annotations-test:log4j-plugins, module 'log4j-api'
>> tests,
>>>>>> maven-annotations-test:log4j-api, module 'log4j-plugins' tests)*
>>>>>> 
>>>>>> Did you get it working? What shall I do to make it work?
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>>