[ 
https://issues.apache.org/jira/browse/LOGGING-68?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Lundberg updated LOGGING-68:
-----------------------------------

    Fix Version/s: 1.1.0

> Incorrect test for availability of log4j
> ----------------------------------------
>
>                 Key: LOGGING-68
>                 URL: https://issues.apache.org/jira/browse/LOGGING-68
>             Project: Commons Logging
>          Issue Type: Bug
>    Affects Versions: 1.0.3
>         Environment: Operating System: other
> Platform: Other
>            Reporter: d
>             Fix For: 1.1.0
>
>
> 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);
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to