Fix bug where priority of first commons-logging.properties file found was ignored.
Also improve diagnostics output. git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@394461 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1387,16 +1387,39 @@ public abstract class LogFactory {
|
|||||||
if (newProps != null) {
|
if (newProps != null) {
|
||||||
if (props == null) {
|
if (props == null) {
|
||||||
props = newProps;
|
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 {
|
} else {
|
||||||
String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
|
String newPriorityStr = newProps.getProperty(PRIORITY_KEY);
|
||||||
|
double newPriority = 0.0;
|
||||||
if (newPriorityStr != null) {
|
if (newPriorityStr != null) {
|
||||||
double newPriority = Double.valueOf(newPriorityStr).doubleValue();
|
newPriority = Double.parseDouble(newPriorityStr);
|
||||||
if (newPriority > priority) {
|
}
|
||||||
props = newProps;
|
|
||||||
priority = newPriority;
|
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) {
|
} catch (SecurityException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user