On 2019/05/27 12:21:38, Gary Gregory <[email protected]> wrote:
> Ralph, why not add null-checks in the loops of the merge methods?
>
> Gary
>
> On Mon, May 27, 2019 at 4:28 AM Gaurav <[email protected]> wrote:
>
> >
> >
> > On 2019/05/24 19:16:33, Ralph Goers <[email protected]> wrote:
> > > Composite configuration implies that you are merging multiple
> > configuration files. Yes, it would appear that the configuration being
> > merged has one node with no configuration under it.
> > >
> > > If you only have a single configuration this shouldn’t happen.
> > >
> > > Ralph
> > >
> > > > On May 24, 2019, at 10:34 AM, Gaurav <[email protected]> wrote:
> > > >
> > > > Hi,
> > > >
> > > > Getting NullPointerException in DefaultMergeStrategy class.
> > > >
> > > > codeblock -
> > > > "if
> > (targetNode.getAttributes().get(NAME).equals(node.getAttributes().get(NAME)))
> > "
> > > >
> > > > Probable suspect is that I've developed an appender similar to
> > failoverappender and it does not contain any child nodes.
> > > > e.g.
> > > >
> > > > <TestRollingFileAppender name="testRollingFileAppender"
> > targetAppenderName="rollingFileAppender" ignoreExceptions="false">
> > > > </TestRollingFileAppender>
> > > >
> > > > Stacktrace -
> > > >
> > > > Exception in thread "Log4j2-TF-28-ConfiguratonFileWatcher-16"
> > java.lang.NullPointerException
> > > > at
> > org.apache.logging.log4j.core.config.composite.DefaultMergeStrategy.mergConfigurations(DefaultMergeStrategy.java:139)
> > > > at
> > org.apache.logging.log4j.core.config.composite.CompositeConfiguration.setup(CompositeConfiguration.java:122)
> > > > at
> > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:235)
> > > > at
> > org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:249)
> > > > at
> > org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:545)
> > > > at
> > org.apache.logging.log4j.core.LoggerContext.onChange(LoggerContext.java:667)
> > > > at
> > org.apache.logging.log4j.core.config.ConfiguratonFileWatcher$ReconfigurationRunnable.run(ConfiguratonFileWatcher.java:68)
> > > > at java.lang.Thread.run(Thread.java:748)
> > > >
> > > > Please assist.
> > > >
> > >
> > >
> > >
> > So, is there any way to fix this or should I ignore the nullpointer
> > exception?
> >
>
Hi Ralph/Gary,
The issue seems to get resolved on log4j 2.11. I just upgraded from log4j 2.9
to 2.11 and it works flawlessly.