You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by cr...@apache.org on 2002/03/31 01:31:49 UTC

cvs commit: jakarta-commons/logging/src/java/org/apache/commons/logging/impl LogFactoryImpl.java

craigmcc    02/03/30 16:31:49

  Modified:    logging/src/java/org/apache/commons/logging/impl
                        LogFactoryImpl.java
  Log:
  Modify the logger discovery contract to perform the complete set of checks
  even in environments (such as an Applet) where System.getProperty() throws
  a security exception.  Previously, this was causing the checks for Log4J or
  JDK 1.4 logging to be skipped.
  
  PR:  Bugzilla #7468
  Reported By:  Tim Vernum (tpv at spamcop.net)
  
  Revision  Changes    Path
  1.7       +29 -22    jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java
  
  Index: LogFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LogFactoryImpl.java	27 Feb 2002 18:01:41 -0000	1.6
  +++ LogFactoryImpl.java	31 Mar 2002 00:31:49 -0000	1.7
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.6 2002/02/27 18:01:41 craigmcc Exp $
  - * $Revision: 1.6 $
  - * $Date: 2002/02/27 18:01:41 $
  + * $Header: /home/cvs/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.7 2002/03/31 00:31:49 craigmcc Exp $
  + * $Revision: 1.7 $
  + * $Date: 2002/03/31 00:31:49 $
    *
    * ====================================================================
    *
  @@ -104,7 +104,7 @@
    *
    * @author Rod Waldhoff
    * @author Craig R. McClanahan
  - * @version $Revision: 1.6 $ $Date: 2002/02/27 18:01:41 $
  + * @version $Revision: 1.7 $ $Date: 2002/03/31 00:31:49 $
    */
   
   public class LogFactoryImpl extends LogFactory {
  @@ -367,29 +367,36 @@
   
           // Identify the Log implementation class we will be using
           String logClassName = null;
  -        try {
  +        if (logClassName == null) {
               logClassName = (String) getAttribute(LOG_PROPERTY);
  -            if (logClassName == null) { // @deprecated
  -                logClassName = (String) getAttribute(LOG_PROPERTY_OLD);
  -            }
  -            if (logClassName == null) {
  +        }
  +        if (logClassName == null) { // @deprecated
  +            logClassName = (String) getAttribute(LOG_PROPERTY_OLD);
  +        }
  +        if (logClassName == null) {
  +            try {
                   logClassName = System.getProperty(LOG_PROPERTY);
  +            } catch (SecurityException e) {
  +                ;
               }
  -            if (logClassName == null) { // @deprecated
  +        }
  +        if (logClassName == null) { // @deprecated
  +            try {
                   logClassName = System.getProperty(LOG_PROPERTY_OLD);
  +            } catch (SecurityException e) {
  +                ;
               }
  -            if ((logClassName == null) && isLog4JAvailable()) {
  -                logClassName =
  -                    "org.apache.commons.logging.impl.Log4JCategoryLog";
  -            }
  -            if ((logClassName == null) && isJdk14Available()) {
  -                logClassName =
  -                    "org.apache.commons.logging.impl.Jdk14Logger";
  -            }
  -            if (logClassName == null) {
  -                logClassName = LOG_DEFAULT;
  -            }
  -        } catch (SecurityException e) {
  +        }
  +        if ((logClassName == null) && isLog4JAvailable()) {
  +            logClassName =
  +                "org.apache.commons.logging.impl.Log4JCategoryLog";
  +        }
  +        if ((logClassName == null) && isJdk14Available()) {
  +            logClassName =
  +                "org.apache.commons.logging.impl.Jdk14Logger";
  +        }
  +        if (logClassName == null) {
  +            logClassName = LOG_DEFAULT;
           }
   
           // Attempt to load the Log implementation class
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>