You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sk...@apache.org on 2006/04/16 13:36:37 UTC

svn commit: r394461 - /jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java

Author: skitching
Date: Sun Apr 16 04:36:37 2006
New Revision: 394461

URL: http://svn.apache.org/viewcvs?rev=394461&view=rev
Log:
Fix bug where priority of first commons-logging.properties file found was ignored.
Also improve diagnostics output.

Modified:
    jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java

Modified: jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java?rev=394461&r1=394460&r2=394461&view=diff
==============================================================================
--- jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java (original)
+++ jakarta/commons/proper/logging/trunk/src/java/org/apache/commons/logging/LogFactory.java Sun Apr 16 04:36:37 2006
@@ -1387,16 +1387,39 @@
                 if (newProps != null) {
                     if (props == null) {
                         props = newProps;
+                        String priorityStr = props.getProperty(PRIORITY_KEY);
+                        priority = 0.0;
+                        if (priorityStr != null) {
+                            priority = Double.parseDouble(priorityStr);
+                        }
+
+                        if (isDiagnosticsEnabled()) {
+                            logDiagnostic(
+                                "[LOOKUP] First properties file found at '" + url + "'");
+                        }
                     } else {
                         String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
+                        double newPriority = 0.0;
                         if (newPriorityStr != null) {
-                            double newPriority = Double.valueOf(newPriorityStr).doubleValue();
-                            if (newPriority > priority) {
-                                props = newProps;
-                                priority = newPriority;
+                            newPriority = Double.parseDouble(newPriorityStr);
+                        }
+
+                        if (newPriority > priority) {
+                            props = newProps;
+                            priority = newPriority;
+
+                            if (isDiagnosticsEnabled()) {
+                                logDiagnostic(
+                                    "[LOOKUP] New properties file found at '" + url + "'"
+                                    + " has higher priority than earlier file."); 
                             }
+                        } else {
+                            logDiagnostic(
+                                "[LOOKUP] New properties file found at '" + url + "'"
+                                + " has less priority than earlier file -- ignoring.");
                         }
                     }
+
                 }
             }
         } catch (SecurityException e) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org