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

Gary Gregory commented on LOG4J2-1108:
--------------------------------------

If we push the NPE fix down to 
{{org.apache.logging.log4j.jul.DefaultLevelConverter}}, then that leaves the 
door open for a custom converter to do something else with a null, like mapping 
null to OFF. 

But at the converter level, you cannot do anything about changing the effective 
level by looking at the parent logger, so what you can do is limited.

The spec says: "If the new level is null, it means that this node should 
inherit its level from its nearest ancestor with a specific (non-null) level 
value."

For us, does that mean we must remove this logger's logger config and set it to 
null?

Right now, {{org.apache.logging.log4j.core.Logger.setLevel(Level)}} does not do 
anything when given a null Level, it's a NoOp.

> NullPointerException when using custom java.util.logging.Level
> --------------------------------------------------------------
>
>                 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
>
> 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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to