Commons Logging
  1. Commons Logging
  2. LOGGING-96

[logging] Include class loader information when LogFactoryImpl throws LogConfigurationException.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.4
    • Fix Version/s: 1.1.0
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      LogFactoryImpl#getLogConstructor throws a LogConfigurationException when the
      same class is detected in multiple class loaders. The error message is as follows:

      "Invalid class loader hierarchy. You have more than one version of <class-name>
      visible, which is not allowed."

      We could improve the usefulness of the error message by including classloader
      details such as ClassLoader#getClass, etc. It would greatly reduce the time
      spent hunting down multiple copies of Commons Logging (which can frequently
      occur when deploying to application servers such as JBoss and WebLogic, as they
      often have a version of Commons Logging stowed away in their own class path).

        Activity

        Hide
        Brian Stansberry added a comment -

        The current trunk version of commons-logging includes the ability to generate a
        great deal of diagnostic information about what it's doing internally. If
        commons-logging is behaving in an unexpected manner, you can now set system
        property org.apache.commons.logging.diagnostics.dest to the value STDOUT, STDERR
        or a filename and you'll get detailed diagnostics.

        Specifically, if an incompatible Log problem occurs, you would get a diagnostic
        message like the following:

        "Class org.apache.commons.logging.impl.Log4J12Logger was found in classloader
        com.x.y.z.WebAppLoader@123456. It is bound to a Log interface which is not
        the one loaded from classloader
        com.x.y.z.ContainerClassLoader@654321."

        Prior to this message there would be other diagnostic info showing how
        commons-logging came to be using WebAppLoader@123456 and
        ContainerClassLoader@654321.

        Show
        Brian Stansberry added a comment - The current trunk version of commons-logging includes the ability to generate a great deal of diagnostic information about what it's doing internally. If commons-logging is behaving in an unexpected manner, you can now set system property org.apache.commons.logging.diagnostics.dest to the value STDOUT, STDERR or a filename and you'll get detailed diagnostics. Specifically, if an incompatible Log problem occurs, you would get a diagnostic message like the following: "Class org.apache.commons.logging.impl.Log4J12Logger was found in classloader com.x.y.z.WebAppLoader@123456. It is bound to a Log interface which is not the one loaded from classloader com.x.y.z.ContainerClassLoader@654321." Prior to this message there would be other diagnostic info showing how commons-logging came to be using WebAppLoader@123456 and ContainerClassLoader@654321.
        Hide
        Dennis Lundberg added a comment -

        Stephen, are you happy with the solution that Brian has presented? Is it OK to
        close this issue?

        Show
        Dennis Lundberg added a comment - Stephen, are you happy with the solution that Brian has presented? Is it OK to close this issue?
        Hide
        Simon Kitching added a comment -

        Closing issue as there has been no feedback. Hopefully this is resolved by the
        new Diagnostics support.

        Show
        Simon Kitching added a comment - Closing issue as there has been no feedback. Hopefully this is resolved by the new Diagnostics support.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development