Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-284

Unusable with Logback-ContextSelectors.

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.7.x
    • jcl-over-slf4j
    • None
    • Operating System: Windows XP
      Platform: PC

    Description

      Caching instances of Slf4j-Loggers prevents Logback-ContextSelectors from working. (See also SLF4J-282 for a similar issue with the log4j bridge.)

      The caching code can be found in org.apache.commons.logging.impl.SLF4JLogFactory:

      public Log getInstance(String name) throws LogConfigurationException {
      Log instance = null;
      // protect against concurrent access of loggerMap
      synchronized (loggerMap) {
      instance = (Log) loggerMap.get(name);
      if (instance == null) {
      Logger logger = LoggerFactory.getLogger(name);
      if(logger instanceof LocationAwareLogger)

      { instance = new SLF4JLocationAwareLog((LocationAwareLogger) logger); }

      else

      { instance = new SLF4JLog(logger); }

      loggerMap.put(name, instance);
      }
      }
      return (instance);

      }

      Attachments

        Activity

          People

            slf4j-dev SLF4J developers list
            thomoell Thomas Möller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: