logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1108) NullPointerException when passing null to java.util.logging.Logger.setLevel()
Date Fri, 28 Aug 2015 19:55:46 GMT

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

Gary Gregory edited comment on LOG4J2-1108 at 8/28/15 7:55 PM:
---------------------------------------------------------------

I see how {{getParent()}} can create a new Logger in the code now.

The {{org.apache.logging.log4j.jul.CoreLoggerTest.testSetLevelToNull()}} fails with:

{code:java}
    public synchronized void setLevel(final Level level) {
        final Level actualLevel = level != null ? level : config.loggerConfig.getParent().getLevel();
        config = new PrivateConfig(config, actualLevel);
    }
{code}


was (Author: garydgregory):
The {{org.apache.logging.log4j.jul.CoreLoggerTest.testSetLevelToNull()}} fails with:

{code:java}
    public synchronized void setLevel(final Level level) {
        final Level actualLevel = level != null ? level : config.loggerConfig.getParent().getLevel();
        config = new PrivateConfig(config, actualLevel);
    }
{code}

> NullPointerException when passing null to java.util.logging.Logger.setLevel()
> -----------------------------------------------------------------------------
>
>                 Key: LOG4J2-1108
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1108
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: JUL adapter
>    Affects Versions: 2.4
>         Environment: -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
>            Reporter: Mikael Ståldal
>            Assignee: Gary Gregory
>            Priority: Blocker
>             Fix For: 2.4
>
>         Attachments: setlevel.patch
>
>
> When using a 3rd party library (Twitter Finagle) which uses a custom java.util.logging.Level,
I get this:
> {code}
> Exception in thread "main" java.lang.NullPointerException
>         at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333)
>         at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:988)
>         at org.apache.logging.log4j.jul.DefaultLevelConverter.toLevel(DefaultLevelConverter.java:119)
>         at org.apache.logging.log4j.jul.LevelTranslator.toLevel(LevelTranslator.java:72)
>         at org.apache.logging.log4j.jul.CoreLogger.setLevel(CoreLogger.java:47)
>         at com.twitter.logging.Logger.setLevel(Logger.scala:63)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message