Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2316

NullPointerException while calling Configurator.setLevel()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.11.0
    • None
    • Core, Web/Servlet
    • None
    • webapplication running in tomcat 8.5

    Description

      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.<init>(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?

      Attachments

        Activity

          People

            Unassigned Unassigned
            Ranjit.Dsouza Ranjit Dsouza
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: