You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2017/06/20 02:53:04 UTC

NPE in LogManager.

Hi All:

I just saw this go by with a local build:

[INFO] Running org.apache.logging.log4j.core.Log4j1222Test
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.002 s - in org.apache.logging.log4j.core.Log4j1222Test
ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already shutting
down.
Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
        at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$
Holder.<clinit>(Log4j1222Test.java:42)
        at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
trigger(Log4j1222Test.java:53)
        at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
run(Log4j1222Test.java:49)
Caused by: java.lang.NullPointerException
        at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:97)
        ... 3 more
[INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest

Thoughts?

Gary

Re: NPE in LogManager.

Posted by Matt Sicker <bo...@gmail.com>.
That's rather strange, but I think it's related to how quickly the JVM is
cycled through in forked tests and isn't anything to worry about. :)

On 20 June 2017 at 20:08, Gary Gregory <ga...@gmail.com> wrote:

> I fixed the NPE, now you just get the "real" exception:
>
> ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already shutting
> down.
> ERROR StatusLogger Unable to create class
> org.apache.logging.log4j.core.impl.Log4jContextFactory specified in
> provider URL null
>  java.lang.IllegalStateException: Shutdown in progress
>         at
> java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
>         at java.lang.Runtime.addShutdownHook(Runtime.java:211)
>         at
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistr
> y.addShutdownHook(DefaultShutdownCallbackRegistry.java:156)
>         at
> org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.start(
> DefaultShutdownCallbackRegistry.java:142)
>         at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.
> initializeShutdownCallbackRegistry(Log4jContextFactory.java:125)
>         at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.<
> init>(Log4jContextFactory.java:92)
>         at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.<
> init>(Log4jContextFactory.java:58)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(
> NativeConstructorAccessorImpl.java:62)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
> DelegatingConstructorAccessorImpl.java:45)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>         at java.lang.Class.newInstance(Class.java:442)
>         at org.apache.logging.log4j.LogManager.<clinit>(
> LogManager.java:94)
>         at
> org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$
> Holder.<clinit>(Log4j1222Test.java:42)
>         at
> org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> trigger(Log4j1222Test.java:53)
>         at
> org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> run(Log4j1222Test.java:49)
>
> But if you run the test by itself, it's fine:
>
> mvn test -Dtest=LogEventFactoryTest -pl log4j-core
>
> INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> 0.015 s - in org.apache.logging.log4j.core.LogEventFactoryTest
>
> Gary
>
> On Tue, Jun 20, 2017 at 7:11 AM, Matt Sicker <bo...@gmail.com> wrote:
>
> > Doesn't sound too serious. Probably had the process killed before it
> fully
> > shut down.
> >
> > On 19 June 2017 at 21:53, Gary Gregory <ga...@gmail.com> wrote:
> >
> > > Hi All:
> > >
> > > I just saw this go by with a local build:
> > >
> > > [INFO] Running org.apache.logging.log4j.core.Log4j1222Test
> > > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> > > 0.002 s - in org.apache.logging.log4j.core.Log4j1222Test
> > > ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already
> > shutting
> > > down.
> > > Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
> > >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$
> > > Holder.<clinit>(Log4j1222Test.java:42)
> > >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> > > trigger(Log4j1222Test.java:53)
> > >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> > > run(Log4j1222Test.java:49)
> > > Caused by: java.lang.NullPointerException
> > >         at org.apache.logging.log4j.LogManager.<clinit>(
> > > LogManager.java:97)
> > >         ... 3 more
> > > [INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest
> > >
> > > Thoughts?
> > >
> > > Gary
> > >
> >
> >
> >
> > --
> > Matt Sicker <bo...@gmail.com>
> >
>



-- 
Matt Sicker <bo...@gmail.com>

Re: NPE in LogManager.

Posted by Gary Gregory <ga...@gmail.com>.
I fixed the NPE, now you just get the "real" exception:

ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already shutting
down.
ERROR StatusLogger Unable to create class
org.apache.logging.log4j.core.impl.Log4jContextFactory specified in
provider URL null
 java.lang.IllegalStateException: Shutdown in progress
        at
java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
        at java.lang.Runtime.addShutdownHook(Runtime.java:211)
        at
org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.addShutdownHook(DefaultShutdownCallbackRegistry.java:156)
        at
org.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry.start(DefaultShutdownCallbackRegistry.java:142)
        at
org.apache.logging.log4j.core.impl.Log4jContextFactory.initializeShutdownCallbackRegistry(Log4jContextFactory.java:125)
        at
org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:92)
        at
org.apache.logging.log4j.core.impl.Log4jContextFactory.<init>(Log4jContextFactory.java:58)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:94)
        at
org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$Holder.<clinit>(Log4j1222Test.java:42)
        at
org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.trigger(Log4j1222Test.java:53)
        at
org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.run(Log4j1222Test.java:49)

But if you run the test by itself, it's fine:

mvn test -Dtest=LogEventFactoryTest -pl log4j-core

INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.015 s - in org.apache.logging.log4j.core.LogEventFactoryTest

Gary

On Tue, Jun 20, 2017 at 7:11 AM, Matt Sicker <bo...@gmail.com> wrote:

> Doesn't sound too serious. Probably had the process killed before it fully
> shut down.
>
> On 19 June 2017 at 21:53, Gary Gregory <ga...@gmail.com> wrote:
>
> > Hi All:
> >
> > I just saw this go by with a local build:
> >
> > [INFO] Running org.apache.logging.log4j.core.Log4j1222Test
> > [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> > 0.002 s - in org.apache.logging.log4j.core.Log4j1222Test
> > ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already
> shutting
> > down.
> > Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
> >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$
> > Holder.<clinit>(Log4j1222Test.java:42)
> >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> > trigger(Log4j1222Test.java:53)
> >         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> > run(Log4j1222Test.java:49)
> > Caused by: java.lang.NullPointerException
> >         at org.apache.logging.log4j.LogManager.<clinit>(
> > LogManager.java:97)
> >         ... 3 more
> > [INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest
> >
> > Thoughts?
> >
> > Gary
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: NPE in LogManager.

Posted by Matt Sicker <bo...@gmail.com>.
Doesn't sound too serious. Probably had the process killed before it fully
shut down.

On 19 June 2017 at 21:53, Gary Gregory <ga...@gmail.com> wrote:

> Hi All:
>
> I just saw this go by with a local build:
>
> [INFO] Running org.apache.logging.log4j.core.Log4j1222Test
> [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> 0.002 s - in org.apache.logging.log4j.core.Log4j1222Test
> ERROR StatusLogger Cannot start ShutdownCallbackRegistry, already shutting
> down.
> Exception in thread "Thread-0" java.lang.ExceptionInInitializerError
>         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook$
> Holder.<clinit>(Log4j1222Test.java:42)
>         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> trigger(Log4j1222Test.java:53)
>         at org.apache.logging.log4j.core.Log4j1222Test$ShutdownHook.
> run(Log4j1222Test.java:49)
> Caused by: java.lang.NullPointerException
>         at org.apache.logging.log4j.LogManager.<clinit>(
> LogManager.java:97)
>         ... 3 more
> [INFO] Running org.apache.logging.log4j.core.LogEventFactoryTest
>
> Thoughts?
>
> Gary
>



-- 
Matt Sicker <bo...@gmail.com>