Commons Logging
  1. Commons Logging
  2. LOGGING-102

[logging] Provide better error message than "No suitable Log implementation"

    Details

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

      Operating System: other
      Platform: Other

      Description

      when trying to do a totally different ant task, I got with debug the following
      exception

      ...\build.xml:3125: java.lang.ExceptionInInitial
      izerError
      at
      org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:114)
      at org.apache.tools.ant.Task.perform(Task.java:365)
      at org.apache.tools.ant.Target.execute(Target.java:356)
      at org.apache.tools.ant.Target.performTasks(Target.java:384)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1236)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1205)
      at
      org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1088)
      at org.apache.tools.ant.Main.runBuild(Main.java:676)
      at org.apache.tools.ant.Main.startAnt(Main.java:195)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:265)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:87)
      Caused by: java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:242)
      at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:551)
      at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:221)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
      org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:104)
      ... 11 more
      Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log
      implementation
      at
      org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:748)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:556)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:307)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:281)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:560)
      at org.apache.jasper.JspC.<clinit>(JspC.java:90)
      ... 20 more
      — Nested Exception —
      java.lang.ExceptionInInitializerError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:242)
      at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:551)
      at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:221)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at
      org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:104)
      at org.apache.tools.ant.Task.perform(Task.java:365)
      at org.apache.tools.ant.Target.execute(Target.java:356)
      at org.apache.tools.ant.Target.performTasks(Target.java:384)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1236)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1205)
      at
      org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1088)
      at org.apache.tools.ant.Main.runBuild(Main.java:676)
      at org.apache.tools.ant.Main.startAnt(Main.java:195)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:265)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:87)
      Caused by: org.apache.commons.logging.LogConfigurationException: No suitable Log
      implementation
      at
      org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:748)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:556)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:307)
      at
      org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:281)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:560)
      at org.apache.jasper.JspC.<clinit>(JspC.java:90)
      ... 20 more

      Total time: 13 secondsClass org.apache.commons.logging.impl.LogFactoryImpl
      loaded from ant loader (parentFirst)
      Class java.lang.ExceptionInInitializerError loaded from parent loader (parentFirst)

      looking at the CVS head, there might be some relief:

      "User-specified log class " + specifiedLogClassName
      + " cannot be found or is not useable."

      but still, it would be really helpful to know what was missing from an admin
      point of view, so on top of the particular class name, it would be very useful,
      to get a hint at
      1) which jar (log4j.jar) that "specifiedLogClassName" most likely is included in?
      2) Or whether the config file was missing (log4j.properties?) and in
      3) which directories/jar files it was searched for...
      4) and what "logCategory" was being aimed for...

        Activity

        Hide
        Simon Kitching added a comment -

        New diagnostics feature improve output for this situation. As described, the
        specific info requested cannot be provided by JCL.

        Show
        Simon Kitching added a comment - New diagnostics feature improve output for this situation. As described, the specific info requested cannot be provided by JCL.
        Hide
        Dennis Lundberg added a comment -

        As you have already noted the error messages have been improved in the code
        currently in SVN. There is also a new internal diagnostics feature. From the
        release notes:

        • added internal diagnostics feature. 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. As commons-logging initialises
          itself for each new contextClassLoader it detects, useful information will
          be output about which logging library is bound to and why.

        1. Guessing in which jar the specifiedLogClassName is included in, is a tricky
        thing to do. Since anyone can write their own Log implementation and package it
        any way they see fit.
        2. If the underlying logging system is not configured properly, I would say that
        it is up to that system to report what might be wrong.
        3. Searching is done using the classpath of the classloader that loaded
        commons-logging
        4. Not sure what you mean here...

        Show
        Dennis Lundberg added a comment - As you have already noted the error messages have been improved in the code currently in SVN. There is also a new internal diagnostics feature. From the release notes: added internal diagnostics feature. 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. As commons-logging initialises itself for each new contextClassLoader it detects, useful information will be output about which logging library is bound to and why. 1. Guessing in which jar the specifiedLogClassName is included in, is a tricky thing to do. Since anyone can write their own Log implementation and package it any way they see fit. 2. If the underlying logging system is not configured properly, I would say that it is up to that system to report what might be wrong. 3. Searching is done using the classpath of the classloader that loaded commons-logging 4. Not sure what you mean here...
        Hide
        Ralf Hauser added a comment -

        looking at the ant debug a little bit more, it might be that the issue was that
        it attempted to use log4j1.3

        Finding class org.apache.jasper.JspC
        Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-compiler.jar
        org/apache/jasper/JspC.class
        Finding class org.apache.jasper.Options
        Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-compiler.jar
        org/apache/jasper/Options.class
        Class java.lang.Object loaded from parent loader (parentFirst)
        Class org.apache.jasper.Options loaded from ant loader (parentFirst)
        Class org.apache.jasper.JspC loaded from ant loader (parentFirst)
        Class java.lang.Throwable loaded from parent loader (parentFirst)
        Class java.io.IOException loaded from parent loader (parentFirst)
        Class java.lang.RuntimeException loaded from parent loader (parentFirst)
        Class java.lang.ClassLoader loaded from parent loader (parentFirst)
        Class java.net.URLClassLoader loaded from parent loader (parentFirst)
        Class java.net.MalformedURLException loaded from parent loader (parentFirst)
        Class java.io.OutputStream loaded from parent loader (parentFirst)
        Class java.io.PrintStream loaded from parent loader (parentFirst)
        Finding class javax.servlet.ServletContext
        Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\servlet-api.jar
        javax/servlet/ServletContext.class
        Class javax.servlet.ServletContext loaded from ant loader (parentFirst)
        Class java.io.Writer loaded from parent loader (parentFirst)
        Class java.io.FileWriter loaded from parent loader (parentFirst)
        Class java.lang.Exception loaded from parent loader (parentFirst)
        Finding class org.apache.jasper.JasperException
        Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-runtime.jar
        org/apache/jasper/JasperException.class
        Finding class javax.servlet.ServletException
        Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\servlet-api.jar
        javax/servlet/ServletException.class
        Class javax.servlet.ServletException loaded from ant loader (parentFirst)
        Class org.apache.jasper.JasperException loaded from ant loader (parentFirst)
        Class java.io.Reader loaded from parent loader (parentFirst)
        Class java.io.FileReader loaded from parent loader (parentFirst)
        Class java.lang.NumberFormatException loaded from parent loader (parentFirst)
        Class java.lang.ClassNotFoundException loaded from parent loader (parentFirst)
        Class java.lang.NoClassDefFoundError loaded from parent loader (parentFirst)
        Class java.lang.Class loaded from parent loader (parentFirst)
        Finding class org.apache.commons.logging.LogFactory
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/LogFactory.class
        Class org.apache.commons.logging.LogFactory loaded from ant loader (parentFirst)
        Class java.lang.SecurityException loaded from parent loader (parentFirst)
        Class java.io.FileOutputStream loaded from parent loader (parentFirst)
        Class java.security.PrivilegedAction loaded from parent loader (parentFirst)
        Finding class org.apache.commons.logging.LogConfigurationException
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/LogConfigurationException.class
        Class org.apache.commons.logging.LogConfigurationException loaded from ant
        loader (parentFirst)
        Class java.lang.NoSuchMethodException loaded from parent loader (parentFirst)
        Class java.lang.reflect.InvocationTargetException loaded from parent loader
        (parentFirst)
        Class java.lang.IllegalAccessException loaded from parent loader (parentFirst)
        Class java.lang.reflect.Method loaded from parent loader (parentFirst)
        Class java.lang.ClassCastException loaded from parent loader (parentFirst)
        Class java.io.UnsupportedEncodingException loaded from parent loader (parentFirst)
        Class java.io.InputStream loaded from parent loader (parentFirst)
        Class java.lang.String loaded from parent loader (parentFirst)
        Class java.io.InputStreamReader loaded from parent loader (parentFirst)
        Class java.lang.System loaded from parent loader (parentFirst)
        Finding class org.apache.commons.logging.impl.WeakHashtable
        Class java.util.Hashtable loaded from parent loader (parentFirst)
        Finding class org.apache.commons.logging.LogFactory$1
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/LogFactory$1.class
        Class org.apache.commons.logging.LogFactory$1 loaded from ant loader (parentFirst)
        Class java.security.AccessController loaded from parent loader (parentFirst)
        Class java.lang.Thread loaded from parent loader (parentFirst)
        Class java.lang.StringBuffer loaded from parent loader (parentFirst)
        Finding class org.apache.commons.logging.LogFactory$3
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/LogFactory$3.class
        Class org.apache.commons.logging.LogFactory$3 loaded from ant loader (parentFirst)
        Finding class org.apache.commons.logging.LogFactory$2
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/LogFactory$2.class
        Class org.apache.commons.logging.LogFactory$2 loaded from ant loader (parentFirst)
        Finding class org.apache.commons.logging.impl.LogFactoryImpl
        Loaded from
        C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar
        org/apache/com
        mons/logging/impl/LogFactoryImpl.class
        Class org.apache.commons.logging.impl.LogFactoryImpl loaded from ant loader
        (parentFirst)
        Class java.lang.ExceptionInInitializerError loaded from parent loader (parentFirst)

        Show
        Ralf Hauser added a comment - looking at the ant debug a little bit more, it might be that the issue was that it attempted to use log4j1.3 Finding class org.apache.jasper.JspC Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-compiler.jar org/apache/jasper/JspC.class Finding class org.apache.jasper.Options Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-compiler.jar org/apache/jasper/Options.class Class java.lang.Object loaded from parent loader (parentFirst) Class org.apache.jasper.Options loaded from ant loader (parentFirst) Class org.apache.jasper.JspC loaded from ant loader (parentFirst) Class java.lang.Throwable loaded from parent loader (parentFirst) Class java.io.IOException loaded from parent loader (parentFirst) Class java.lang.RuntimeException loaded from parent loader (parentFirst) Class java.lang.ClassLoader loaded from parent loader (parentFirst) Class java.net.URLClassLoader loaded from parent loader (parentFirst) Class java.net.MalformedURLException loaded from parent loader (parentFirst) Class java.io.OutputStream loaded from parent loader (parentFirst) Class java.io.PrintStream loaded from parent loader (parentFirst) Finding class javax.servlet.ServletContext Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\servlet-api.jar javax/servlet/ServletContext.class Class javax.servlet.ServletContext loaded from ant loader (parentFirst) Class java.io.Writer loaded from parent loader (parentFirst) Class java.io.FileWriter loaded from parent loader (parentFirst) Class java.lang.Exception loaded from parent loader (parentFirst) Finding class org.apache.jasper.JasperException Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\jasper-runtime.jar org/apache/jasper/JasperException.class Finding class javax.servlet.ServletException Loaded from C:\usr\local\jakarta-tomcat\curr\common\lib\servlet-api.jar javax/servlet/ServletException.class Class javax.servlet.ServletException loaded from ant loader (parentFirst) Class org.apache.jasper.JasperException loaded from ant loader (parentFirst) Class java.io.Reader loaded from parent loader (parentFirst) Class java.io.FileReader loaded from parent loader (parentFirst) Class java.lang.NumberFormatException loaded from parent loader (parentFirst) Class java.lang.ClassNotFoundException loaded from parent loader (parentFirst) Class java.lang.NoClassDefFoundError loaded from parent loader (parentFirst) Class java.lang.Class loaded from parent loader (parentFirst) Finding class org.apache.commons.logging.LogFactory Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/LogFactory.class Class org.apache.commons.logging.LogFactory loaded from ant loader (parentFirst) Class java.lang.SecurityException loaded from parent loader (parentFirst) Class java.io.FileOutputStream loaded from parent loader (parentFirst) Class java.security.PrivilegedAction loaded from parent loader (parentFirst) Finding class org.apache.commons.logging.LogConfigurationException Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/LogConfigurationException.class Class org.apache.commons.logging.LogConfigurationException loaded from ant loader (parentFirst) Class java.lang.NoSuchMethodException loaded from parent loader (parentFirst) Class java.lang.reflect.InvocationTargetException loaded from parent loader (parentFirst) Class java.lang.IllegalAccessException loaded from parent loader (parentFirst) Class java.lang.reflect.Method loaded from parent loader (parentFirst) Class java.lang.ClassCastException loaded from parent loader (parentFirst) Class java.io.UnsupportedEncodingException loaded from parent loader (parentFirst) Class java.io.InputStream loaded from parent loader (parentFirst) Class java.lang.String loaded from parent loader (parentFirst) Class java.io.InputStreamReader loaded from parent loader (parentFirst) Class java.lang.System loaded from parent loader (parentFirst) Finding class org.apache.commons.logging.impl.WeakHashtable Class java.util.Hashtable loaded from parent loader (parentFirst) Finding class org.apache.commons.logging.LogFactory$1 Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/LogFactory$1.class Class org.apache.commons.logging.LogFactory$1 loaded from ant loader (parentFirst) Class java.security.AccessController loaded from parent loader (parentFirst) Class java.lang.Thread loaded from parent loader (parentFirst) Class java.lang.StringBuffer loaded from parent loader (parentFirst) Finding class org.apache.commons.logging.LogFactory$3 Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/LogFactory$3.class Class org.apache.commons.logging.LogFactory$3 loaded from ant loader (parentFirst) Finding class org.apache.commons.logging.LogFactory$2 Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/LogFactory$2.class Class org.apache.commons.logging.LogFactory$2 loaded from ant loader (parentFirst) Finding class org.apache.commons.logging.impl.LogFactoryImpl Loaded from C:\usr\local\jakarta-tomcat\curr\shared\lib\commons-logging-1.1-dev.jar_050915_forLog4j13.jar org/apache/com mons/logging/impl/LogFactoryImpl.class Class org.apache.commons.logging.impl.LogFactoryImpl loaded from ant loader (parentFirst) Class java.lang.ExceptionInInitializerError loaded from parent loader (parentFirst)

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development