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:43:30 UTC

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

Author: skitching
Date: Sun Apr 16 04:43:29 2006
New Revision: 394462

URL: http://svn.apache.org/viewcvs?rev=394462&view=rev
Log:
Improve diagnostics

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=394462&r1=394461&r2=394462&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:43:29 2006
@@ -1373,6 +1373,7 @@
 
         Properties props = null;
         double priority = 0.0;
+        URL propsUrl = null;
         try {
             Enumeration urls = getResources(classLoader, fileName);
 
@@ -1386,6 +1387,7 @@
                 Properties newProps = getProperties(url);
                 if (newProps != null) {
                     if (props == null) {
+                        propsUrl = url; 
                         props = newProps;
                         String priorityStr = props.getProperty(PRIORITY_KEY);
                         priority = 0.0;
@@ -1395,7 +1397,8 @@
 
                         if (isDiagnosticsEnabled()) {
                             logDiagnostic(
-                                "[LOOKUP] First properties file found at '" + url + "'");
+                                "[LOOKUP] Properties file found at '" + url + "'"
+                                + " with priority " + priority); 
                         }
                     } else {
                         String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
@@ -1405,18 +1408,27 @@
                         }
 
                         if (newPriority > priority) {
+                            if (isDiagnosticsEnabled()) {
+                                if (isDiagnosticsEnabled()) {
+                                    logDiagnostic(
+                                        "[LOOKUP] Properties file at '" + url + "'"
+                                        + " with priority " + newPriority 
+                                        + " overrides file at '" + propsUrl + "'"
+                                        + " with priority " + priority);
+                                }
+                            }
+
+                            propsUrl = url; 
                             props = newProps;
                             priority = newPriority;
-
+                        } else {
                             if (isDiagnosticsEnabled()) {
                                 logDiagnostic(
-                                    "[LOOKUP] New properties file found at '" + url + "'"
-                                    + " has higher priority than earlier file."); 
+                                    "[LOOKUP] Properties file at '" + url + "'"
+                                    + " with priority " + newPriority 
+                                    + " does not override file at '" + propsUrl + "'"
+                                    + " with priority " + priority);
                             }
-                        } else {
-                            logDiagnostic(
-                                "[LOOKUP] New properties file found at '" + url + "'"
-                                + " has less priority than earlier file -- ignoring.");
                         }
                     }
 



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


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

Posted by Dennis Lundberg <de...@apache.org>.
See below...

skitching@apache.org wrote:
> Author: skitching
> Date: Sun Apr 16 04:43:29 2006
> New Revision: 394462
> 
> URL: http://svn.apache.org/viewcvs?rev=394462&view=rev
> Log:
> Improve diagnostics
> 
> 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=394462&r1=394461&r2=394462&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:43:29 2006
> @@ -1373,6 +1373,7 @@
>  
>          Properties props = null;
>          double priority = 0.0;
> +        URL propsUrl = null;
>          try {
>              Enumeration urls = getResources(classLoader, fileName);
>  
> @@ -1386,6 +1387,7 @@
>                  Properties newProps = getProperties(url);
>                  if (newProps != null) {
>                      if (props == null) {
> +                        propsUrl = url; 
>                          props = newProps;
>                          String priorityStr = props.getProperty(PRIORITY_KEY);
>                          priority = 0.0;
> @@ -1395,7 +1397,8 @@
>  
>                          if (isDiagnosticsEnabled()) {
>                              logDiagnostic(
> -                                "[LOOKUP] First properties file found at '" + url + "'");
> +                                "[LOOKUP] Properties file found at '" + url + "'"
> +                                + " with priority " + priority); 
>                          }
>                      } else {
>                          String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
> @@ -1405,18 +1408,27 @@
>                          }
>  
>                          if (newPriority > priority) {
> +                            if (isDiagnosticsEnabled()) {
> +                                if (isDiagnosticsEnabled()) {

One check should be enough, don't you think ;-)

> +                                    logDiagnostic(
> +                                        "[LOOKUP] Properties file at '" + url + "'"
> +                                        + " with priority " + newPriority 
> +                                        + " overrides file at '" + propsUrl + "'"
> +                                        + " with priority " + priority);
> +                                }
> +                            }
> +
> +                            propsUrl = url; 
>                              props = newProps;
>                              priority = newPriority;
> -
> +                        } else {
>                              if (isDiagnosticsEnabled()) {
>                                  logDiagnostic(
> -                                    "[LOOKUP] New properties file found at '" + url + "'"
> -                                    + " has higher priority than earlier file."); 
> +                                    "[LOOKUP] Properties file at '" + url + "'"
> +                                    + " with priority " + newPriority 
> +                                    + " does not override file at '" + propsUrl + "'"
> +                                    + " with priority " + priority);
>                              }
> -                        } else {
> -                            logDiagnostic(
> -                                "[LOOKUP] New properties file found at '" + url + "'"
> -                                + " has less priority than earlier file -- ignoring.");
>                          }
>                      }
>  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 


-- 
Dennis Lundberg

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