Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-94

LoggerFactory doesnt respect custom ContextSelector

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • None
    • None
    • Windows XP64, Java 6, Red5 v0.7.1-dev, Logback 0.9.9, Slf4j 1.5.0

    Description

      I have found that calling LoggerFactory.getLogger(xxxx) does not make calls to my custom context selector. I expect to see a call to getLoggerContext() but I dont. Do I need to create my own LoggerFactory impl to get my web context apps and red5 apps to use their own Loggers?

      Main Red5 trunk (dev)
      http://svn1.cvsdude.com/osflash/red5/java/server/trunk/

      My logger implementations
      http://svn1.cvsdude.com/osflash/red5/java/server/trunk/src/org/red5/logging/

      Example JSP I used to test the log context selection

      <%@page import="org.slf4j.Logger,org.slf4j.LoggerFactory,org.slf4j.impl.StaticLoggerBinder,ch.qos.logback.classic.LoggerContext,org.red5.logging.LoggingContextSelector"%>
      <html>
      <body>
      <%
      //
      Logger log = LoggerFactory.getLogger("TestJsp");
      log.info("This is a test log entry from a web context");

      //
      LoggingContextSelector selector = (LoggingContextSelector) StaticLoggerBinder.SINGLETON.getContextSelector();
      LoggerContext ctx = selector.getLoggerContext(mywebappcontextname);
      Logger log2 = ctx.getLogger("TestJsp");
      log2.info("This is a test log entry from a web context attempt 2");

      %>
      </body>
      </html>

      The first log goes to the "default" logger context and the second goes to the correct one. I also implemented the Servlet filter and context listener for this tested context.

      Anything I can do to help, please let me know.. I am getting extremely frustrated with this logging stuff and I'm sure our users are as well.

      Attachments

        Activity

          People

            logback-dev Logback dev list
            mondain Paul Gregoire
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: