From 76cc63f74cb342927b4d85afb700f1df0342443d Mon Sep 17 00:00:00 2001 From: Simon Kitching Date: Sun, 16 Apr 2006 11:43:29 +0000 Subject: [PATCH] Improve diagnostics git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@394462 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/commons/logging/LogFactory.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/java/org/apache/commons/logging/LogFactory.java b/src/java/org/apache/commons/logging/LogFactory.java index e37b17c..fec97d0 100644 --- a/src/java/org/apache/commons/logging/LogFactory.java +++ b/src/java/org/apache/commons/logging/LogFactory.java @@ -1373,6 +1373,7 @@ public abstract class LogFactory { Properties props = null; double priority = 0.0; + URL propsUrl = null; try { Enumeration urls = getResources(classLoader, fileName); @@ -1386,6 +1387,7 @@ public abstract class LogFactory { 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 @@ public abstract class LogFactory { 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 @@ public abstract class LogFactory { } 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."); } }