Log4j 2
  1. Log4j 2
  2. LOG4J2-394

ClassLoaderContextSelector logging WARN messages

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-beta9
    • Fix Version/s: None
    • Component/s: Configurators
    • Labels:
      None

      Description

      I am getting the following WARN message everytime my application logs something.


      WARN locateContext called with URI null. Existing LoggerContext has URI classpath:log4j/local.log4j.xml

      I traced this to ClassLoaderContextSelector -

      if (ctx != null) {
                  if (ctx.getConfigLocation() == null && configLocation != null) {
                      LOGGER.debug("Setting configuration to {}", configLocation);
                      ctx.setConfigLocation(configLocation);
                  } else if (ctx.getConfigLocation() != null && !ctx.getConfigLocation().equals(configLocation)) {
                      LOGGER.warn("locateContext called with URI {}. Existing LoggerContext has URI {}", configLocation,
                          ctx.getConfigLocation());
                  }
                  return ctx;
              }
      

      Ralph Goers Ralph Goers Why are we logging these WARN messages?

        Issue Links

          Activity

          Abhinav Shah created issue -
          Abhinav Shah made changes -
          Field Original Value New Value
          Description I am getting the following WARN message everytime my application logs something.

          {color:red}
          WARN locateContext called with URI null. Existing LoggerContext has URI classpath:log4j/local.log4j.xml
          {color}

          I traced this to ClassLoaderContextSelector -
          {code}
          if (ctx != null) {
                      if (ctx.getConfigLocation() == null && configLocation != null) {
                          LOGGER.debug("Setting configuration to {}", configLocation);
                          ctx.setConfigLocation(configLocation);
                      } else if (ctx.getConfigLocation() != null && !ctx.getConfigLocation().equals(configLocation)) {
                          LOGGER.warn("locateContext called with URI {}. Existing LoggerContext has URI {}", configLocation,
                              ctx.getConfigLocation());
                      }
                      return ctx;
                  }
          {code}
          I am getting the following WARN message everytime my application logs something.

          {color:red}
          WARN locateContext called with URI null. Existing LoggerContext has URI classpath:log4j/local.log4j.xml
          {color}

          I traced this to ClassLoaderContextSelector -
          {code}
          if (ctx != null) {
                      if (ctx.getConfigLocation() == null && configLocation != null) {
                          LOGGER.debug("Setting configuration to {}", configLocation);
                          ctx.setConfigLocation(configLocation);
                      } else if (ctx.getConfigLocation() != null && !ctx.getConfigLocation().equals(configLocation)) {
                          LOGGER.warn("locateContext called with URI {}. Existing LoggerContext has URI {}", configLocation,
                              ctx.getConfigLocation());
                      }
                      return ctx;
                  }
          {code}

          [~ralph_goers@dslextreme.com] [~ralph.goers@dslextreme.com] Why are we logging these WARN messages?
          Nick Williams made changes -
          Link This issue is related to LOG4J2-293 [ LOG4J2-293 ]
          Nick Williams made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Duplicate [ 3 ]
          Nick Williams made changes -
          Resolution Duplicate [ 3 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Assignee Ralph Goers [ ralph.goers@dslextreme.com ]
          Ralph Goers made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              Ralph Goers
              Reporter:
              Abhinav Shah
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development