[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-22 Thread Ralph Goers (JIRA)


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

Ralph Goers commented on LOG4J2-2316:
-

I don't see the point. Error is clearly documented as the default, it is never 
going to change and we only deal with it in a couple of places.

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-22 Thread Gary Gregory (JIRA)


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

Gary Gregory commented on LOG4J2-2316:
--

Don't we use (or want to) a constant to note the default level someplace?

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-22 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on LOG4J2-2316:
-

Commit 419944877c5161b05d6eb294cdb185e9df036fb3 in logging-log4j2's branch 
refs/heads/master from [~ralph.go...@dslextreme.com]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=4199448 ]

LOG4J2-2316 - If root LoggerConfig does not have a Level return ERROR


> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-22 Thread ASF subversion and git services (JIRA)


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

ASF subversion and git services commented on LOG4J2-2316:
-

Commit ab548ce56dfab2c8db9ecc97365e8f734949509a in logging-log4j2's branch 
refs/heads/release-2.x from [~ralph.go...@dslextreme.com]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=ab548ce ]

LOG4J2-2316 - If root LoggerConfig does not have a Level return ERROR


> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-21 Thread Ralph Goers (JIRA)


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

Ralph Goers commented on LOG4J2-2316:
-

The parent is null when the logger config is the root logger. As such, it is 
completely normal for it to be null. Of course, when the parent is null the 
name will be "".  If you don't allow a null value what would the root logger 
reference?

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-21 Thread Gary Gregory (JIRA)


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

Gary Gregory commented on LOG4J2-2316:
--

Question to the community:

In the method 
{{org.apache.logging.log4j.core.config.LoggerConfig.logParent(LogEvent, 
LoggerConfigPredicate)}} we check for a null parent which seems to mean that we 
allow for a null LoggerConfig parent.

This leads me to ask: What is the difference between a null LoggerConfig and a 
LoggerConfig for the root logger ("")?

As an experiment I changed LoggerConfig setParent to:

{code:java}
public void setParent(final LoggerConfig parent) {
 this.parent = Objects.requireNonNull(parent, "parent");
}
{code}
A full build with {{mvn clean install}} but that means that we don't have the 
kind of test that duplicates the above problem.

We could alternatively add a null check in 
{{org.apache.logging.log4j.core.config.LoggerConfig.getLevel()}} but that would 
only pass the buck on the NPE to call sites of {{getLevel()}}.

My inclination is to update LoggerConfig to not allow setParent to accept null 
and see what happens for [~Ranjit.Dsouza]; we should see a new NPE from where 
the null parent comes from...

Thoughts?


> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-21 Thread Gary Gregory (JIRA)


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

Gary Gregory commented on LOG4J2-2316:
--

I see you wrote:

{quote}
Configurator.setLevel(className, levelToSet);//line where exception is thrown 
when levelToSet is null
{quote}

May you paste the exception here please?

Gary

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core, Web/Servlet
>Affects Versions: 2.11.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-07-18 Thread Ranjit Dsouza (JIRA)


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

Ranjit Dsouza commented on LOG4J2-2316:
---

Hi Gary,

The exception has been observed on log4j version 2.11.0 as well. I am pasting 
the stack trace here, but it is pretty much the same as the earlier one. I can 
assure you that log4j was initialized at least 20 seconds before this happened. 
So far, this error has only been seen on Linux

11-Jul-2018 19:05:08.447 SEVERE [localhost-startStop-1] 
org.apache.catalina.core.StandardContext.loadOnStartup Servlet [dispatcher] in 
web application [/netbackup] threw load() exception
 java.lang.NullPointerException
    at 
org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
    at 
org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
    at org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
    at 
org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:654)
    at 
org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:643)
    at 
org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
    at 
com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
    at 
com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
    at 
com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
    at 
com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
    at 
com.netbackup.config.servers.controller.DefaultMSDPHostAccessValidator.(DefaultMSDPHostAccessValidator.java:18)
    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)
    at 
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1108)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1060)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)
    at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)
    at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
    at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
    at 
org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
    at 
org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:540)
    at 
org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
    at 
org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at 
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:986)
    at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4939)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5249)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(T

[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-26 Thread Ranjit Dsouza (JIRA)

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

Ranjit Dsouza commented on LOG4J2-2316:
---

copy pasting the code from where the exception originated: This is the function 
that creates a logger for a given class and returns that logger.

 
{code:java}
public static DebugLogger getLogger(String className) {
   LogManager.getLogger(className);
   //read a custom config file and check if there is an entry for className, if 
so return the corresponding level, else   return null
   Level levelToSet = configure(className);
  Configurator.setLevel(className, levelToSet);//line where exception is thrown 
when levelToSet is null
  return logger;
}
{code}
 

 

Question:
 # Do we need to call Configurator.setLevel() ? Any harm, considering that it 
is not part of the public API?  This is especially since we are explicitly 
setting the root logger level earlier, so it should inherit the log level from 
root logger config,
 # Seems like this function is resilient in handling null as input, except in 
few cases, during which the NPE is thrown.
 # Any alternative in case we shouldn't use this function call?
 # Would it be advisable to put a null check before calling 
Configurator.setLevel ? This means only set the logger level if it is defined 
in our config, else, the logger hopefully would just inherit the level from the 
root logger.

Let me know your thoughts on the above points

Thanks!

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-19 Thread Gary Gregory (JIRA)

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

Gary Gregory commented on LOG4J2-2316:
--

We consider version 2.11.0 to be stable. The next release will likely be 2.11.1 
but we do not have a schedule for this event.

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-19 Thread Ranjit Dsouza (JIRA)

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

Ranjit Dsouza commented on LOG4J2-2316:
---

Yes, let's take this forward
I will use version 2.11.0 and see if there is an improvement. I will get back 
in case I see the issue recur again.

Can you guide me on version 2.11?
   should we wait for the next upcoming stable version after 2.11, or is the 
current version 2.11 good enough? 

Thanks
Ranjit D'Souza



> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-18 Thread Gary Gregory (JIRA)

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

Gary Gregory commented on LOG4J2-2316:
--

If we want to move this forward, lets start with:
 # Try the current version 2.11.0 and post your stack trace if it fails.
 # If the above fails, try 2.11.1-SNAPSHOT and post your stack trace if it 
fails.

And we will take it from there, with a stack trace based on 2.11.1-SNAPSHOT it 
will be easier to look at the current code.

If you feel like checkout out the sources, you could try to add {{volatile}} to 
{{org.apache.logging.log4j.core.config.LoggerConfig.parent}} and see if that 
helps with any possible multi-threaded issue.

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-16 Thread Gary Gregory (JIRA)

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

Gary Gregory commented on LOG4J2-2316:
--

Interesting data point: 

If you run, the following by itself:

{code:java}
@Test
 public void testSetLevel() {
 Configurator.setLevel("test", Level.DEBUG);
 }
{code}

You will _not_ get an NPE and Log4j initializes itself as you can tell from the 
console message:

{noformat}
ERROR StatusLogger No Log4j 2 configuration file found. Using default 
configuration (logging only errors to the console), or user programmatically 
provided configurations. Set system property 'log4j2.debug' to show Log4j 2 
internal initialization logging. See 
https://logging.apache.org/log4j/2.x/manual/configuration.html for instructions 
on how to configure Log4j 2
{noformat}

In order for you to get this NPE, there must be some competition between Log4j 
initializing itself and the call to {{setLevel(String, Level)}}.

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-15 Thread Ranjit Dsouza (JIRA)

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

Ranjit Dsouza commented on LOG4J2-2316:
---

Thanks Gary for taking a look at this!

On the face of it, this seems to be a timing issue (This is our assumption), 
wherin Configurator.setLevel() is getting called even before log4j was able to 
initialize properly.
This issue manifests ONLY during webserver(Tomcat) startup. 
During web application initialization, all ServletContextListeners are notified 
of context initialization, after which all filters get initialized, by calling 
their respective init() methods.
The filer init() method is seen in the stack trace shown below, which kinda 
kick starts this issue. 

03-Apr-2018 13:03:39.854 SEVERE [localhost-startStop-1] 
org.apache.catalina.core.StandardContext.filterStart Exception starting filter. 
java.lang.NullPointerException
    at 
org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
    at 
org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
    at 
org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
    at 
org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
    at 
org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
    at 
org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
    at 
com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
    at 
com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
    at 
com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
    at 
com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
    at 
com.netbackup.config.FeatureToggleFilter.init(FeatureToggleFilter.java:46)
    at 
org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
    at 
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:112)
    at 
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4599)
    at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5241)
    at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
    at 
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)


This is the same stack I showed earlier, more complete now. See the line 
"FeatureToggleFilter.init"
Also, the issue is highly non-reproducible, happens only 'once in a blue moon' 
kindof situation. Therefore it is not easy to simulate this failure

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>   

[jira] [Commented] (LOG4J2-2316) NullPointerException while calling Configurator.setLevel()

2018-04-15 Thread Gary Gregory (JIRA)

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

Gary Gregory commented on LOG4J2-2316:
--

Hi [~Ranjit.Dsouza] and thank you for your report.

Is your application multi-threaded? Can you give us more details or create a 
test to reproduce the problem?

Also, can you try with our current version 2.11.0?

Thank you,
Gary

> NullPointerException while calling Configurator.setLevel()
> --
>
> Key: LOG4J2-2316
> URL: https://issues.apache.org/jira/browse/LOG4J2-2316
> Project: Log4j 2
>  Issue Type: Bug
>  Components: Core
>Affects Versions: 2.10.0
> Environment: webapplication running in tomcat 8.5
>Reporter: Ranjit Dsouza
>Priority: Major
>
> Hi I want to report an intermittent issue in my webapplication wherein log4j 
> throws an NPE.
> Here is the stack trace:
> java.lang.NullPointerException
>     at 
> org.apache.logging.log4j.core.config.LoggerConfig.getLevel(LoggerConfig.java:268)
>     at 
> org.apache.logging.log4j.core.Logger$PrivateConfig.(Logger.java:384)
>     at 
> org.apache.logging.log4j.core.Logger.updateConfiguration(Logger.java:365)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:652)
>     at 
> org.apache.logging.log4j.core.LoggerContext.updateLoggers(LoggerContext.java:641)
>     at 
> org.apache.logging.log4j.core.config.Configurator.setLevel(Configurator.java:296)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:346)
>     at 
> com.netbackup.logging.util.DebugLoggerFactory.getLogger(DebugLoggerFactory.java:359)
>     at 
> com.netbackup.logging.util.WebServiceLoggerFactory.getLogger(WebServiceLoggerFactory.java:14)
>     at 
> com.netbackup.common.logging.LoggerFactory.getLogger(LoggerFactory.java:34)
>  
> Log4j code where the NPE occurs: (LoggerConfig.java)
>     /**
>   * Returns the logging Level.
>   *
>   * @return the logging Level.
>   */
>      public Level getLevel()
> {     return level == null ? parent.getLevel() : level;     } //This is 
> the line where the NPE gets thrown
>  
> Inference is parent(LoggerConfig) itself was null. When can this situation 
> arise?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)