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

ASF GitHub Bot commented on IGNITE-6362:
----------------------------------------

GitHub user apopovgg opened a pull request:

    https://github.com/apache/ignite/pull/2804

    IGNITE-6362: NPE in Log4J2Logger

    1. There was an issue inside Log4J2Logger.createConsoleLogger(). null was 
passed instead of LoggerContext during ad-hoc logger creation via 
LoggerConfig.createLogger()
    2. There were issues with unit tests:
    Log4J2Logger holds context (static) for all logger instances and it is not 
expected to re-configure it on the fly. That was the issue to run tests 
one-by-one with different log configuration. A new method 
Log4J2Logger.cleanup() was implemented to terminate the Log4J logger context.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/gridgain/apache-ignite ignite-6362

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/ignite/pull/2804.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2804
    
----
commit 7f3fed9f83b252a6d723f9e76ea4d9a9221629ed
Author: apopov <[email protected]>
Date:   2017-10-05T07:19:46Z

    IGNITE-6362: NPE in Log4J2Logger

----


> NPE in Log4J2Logger
> -------------------
>
>                 Key: IGNITE-6362
>                 URL: https://issues.apache.org/jira/browse/IGNITE-6362
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.1
>            Reporter: Valentin Kulichenko
>            Assignee: Alexey Popov
>             Fix For: 2.4
>
>
> When I start a node with {{Log4J2Logger}} configured and verbose mode 
> ({{-DIGNITE_QUIET=false}}, it fails with NPE:
> {noformat}
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.logging.log4j.core.config.LoggerConfig.<init>(LoggerConfig.java:145)
>       at 
> org.apache.logging.log4j.core.config.LoggerConfig.createLogger(LoggerConfig.java:523)
>       at 
> org.apache.ignite.logger.log4j2.Log4J2Logger.createConsoleLogger(Log4J2Logger.java:380)
>       at 
> org.apache.ignite.logger.log4j2.Log4J2Logger.addConsoleAppenderIfNeeded(Log4J2Logger.java:338)
>       at 
> org.apache.ignite.logger.log4j2.Log4J2Logger.<init>(Log4J2Logger.java:145)
>       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 
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)
>       ... 34 more
> {noformat}
> This is caused by the fact that {{Log4J2Logger#createConsoleLogger}} method 
> invokes {{LoggerConfig.createLogger}} providing {{null}} as {{Configuration}} 
> object, which unconditionally causes NPE. Need to provide some default 
> configuration instead.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to