DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31597>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31597

Incorrect test for availability of log4j

           Summary: Incorrect test for availability of log4j
           Product: Commons
           Version: 1.0.3
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Logging
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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);
        }
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to