Improve diagnostics
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@394462 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1373,6 +1373,7 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
Properties props = null;
|
Properties props = null;
|
||||||
double priority = 0.0;
|
double priority = 0.0;
|
||||||
|
URL propsUrl = null;
|
||||||
try {
|
try {
|
||||||
Enumeration urls = getResources(classLoader, fileName);
|
Enumeration urls = getResources(classLoader, fileName);
|
||||||
|
|
||||||
@@ -1386,6 +1387,7 @@ public abstract class LogFactory {
|
|||||||
Properties newProps = getProperties(url);
|
Properties newProps = getProperties(url);
|
||||||
if (newProps != null) {
|
if (newProps != null) {
|
||||||
if (props == null) {
|
if (props == null) {
|
||||||
|
propsUrl = url;
|
||||||
props = newProps;
|
props = newProps;
|
||||||
String priorityStr = props.getProperty(PRIORITY_KEY);
|
String priorityStr = props.getProperty(PRIORITY_KEY);
|
||||||
priority = 0.0;
|
priority = 0.0;
|
||||||
@@ -1395,7 +1397,8 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic(
|
||||||
"[LOOKUP] First properties file found at '" + url + "'");
|
"[LOOKUP] Properties file found at '" + url + "'"
|
||||||
|
+ " with priority " + priority);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
|
String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
|
||||||
@@ -1405,18 +1408,27 @@ public abstract class LogFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newPriority > priority) {
|
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;
|
props = newProps;
|
||||||
priority = newPriority;
|
priority = newPriority;
|
||||||
|
} else {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic(
|
||||||
"[LOOKUP] New properties file found at '" + url + "'"
|
"[LOOKUP] Properties file at '" + url + "'"
|
||||||
+ " has higher priority than earlier file.");
|
+ " 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.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user