Commons Logging
  1. Commons Logging
  2. LOGGING-68

Incorrect test for availability of log4j

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 1.1.0
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      Corrrected code from LogFactoryImpl is below. Log4j is only available if the
      the class loader that loads Log4JLogger can load Logger. The orginal test
      is incorrect when both of these conditions are met
      a.) the context loader can load Logger ( directly or not ), and
      b.) Log4jLogger is actually loaded by a parent of the loader that loads Logger.

      The failure of course occurs because Log4jLogger has a direct dep on Logger.

      protected boolean isLog4JAvailable() {

      try

      { /* <incorrect> */ //loadClass("org.apache.log4j.Logger"); //loadClass("org.apache.commons.logging.impl.Log4JLogger"); /* </incorrect> */ loadClass("org.apache.commons.logging.impl.Log4JLogger").getClassLoader().loadClass( "org.apache.log4j.Logger" ); return (true); }

      catch (Throwable t)

      { return (false); }

      }

        Activity

        Hide
        rdonkin@apache.org added a comment -

        Patch committed. Many Thanks.

        Robert

        Show
        rdonkin@apache.org added a comment - Patch committed. Many Thanks. Robert

          People

          • Assignee:
            Unassigned
            Reporter:
            d
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development