sdeboy 2004/07/09 07:41:06
Modified: src/java/org/apache/log4j/xml UtilLoggingXMLDecoder.java
XMLDecoder.java
src/java/org/apache/log4j/chainsaw ChainsawConstants.java
src/java/org/apache/log4j/chainsaw/help release-notes.html
Log:
XML decoders now set additional event properties (hostName, application) when they
aren't provided in the XML.
Revision Changes Path
1.17 +9 -3
logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java
Index: UtilLoggingXMLDecoder.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/xml/UtilLoggingXMLDecoder.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- UtilLoggingXMLDecoder.java 27 May 2004 12:16:57 -0000 1.16
+++ UtilLoggingXMLDecoder.java 9 Jul 2004 14:41:06 -0000 1.17
@@ -25,6 +25,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -82,8 +83,6 @@
} catch (ParserConfigurationException pce) {
System.err.println("Unable to get document builder");
}
-
- additionalProperties.put("log4j.eventtype", "util-logging");
}
/**
@@ -354,9 +353,16 @@
if (properties == null) {
properties = new Hashtable(additionalProperties);
} else {
- properties.putAll(additionalProperties);
+ Iterator i = additionalProperties.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ if (!(properties.containsKey(e.getKey()))) {
+ properties.put(e.getKey(), e.getValue());
+ }
+ }
}
}
+
LocationInfo info = null;
if ((fileName != null) || (className != null) || (methodName != null) ||
(lineNumber != null)) {
info = new LocationInfo(fileName, className, methodName, lineNumber);
1.20 +10 -13 logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java
Index: XMLDecoder.java
===================================================================
RCS file: /home/cvs/logging-log4j/src/java/org/apache/log4j/xml/XMLDecoder.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XMLDecoder.java 27 May 2004 12:16:57 -0000 1.19
+++ XMLDecoder.java 9 Jul 2004 14:41:06 -0000 1.20
@@ -24,6 +24,7 @@
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.Iterator;
import java.util.Map;
import java.util.Vector;
@@ -34,7 +35,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
-import org.apache.log4j.UtilLoggingLevel;
import org.apache.log4j.spi.Decoder;
import org.apache.log4j.spi.LocationInfo;
import org.apache.log4j.spi.LoggingEvent;
@@ -350,27 +350,24 @@
/**
* We add all the additional properties to the properties
- * hashtable
+ * hashtable. Don't override properties that already exist
*/
if (additionalProperties.size() > 0) {
if (properties == null) {
properties = new Hashtable(additionalProperties);
} else {
- properties.putAll(additionalProperties);
+ Iterator i = additionalProperties.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry e = (Map.Entry) i.next();
+ if (!(properties.containsKey(e.getKey()))) {
+ properties.put(e.getKey(), e.getValue());
+ }
+ }
}
}
}
- Level levelImpl = null;
- if ((properties != null) && (properties.get("log4j.eventtype") != null)) {
- String s = (String)properties.get("log4j.eventtype");
- if ("util-logging".equalsIgnoreCase(s)) {
- levelImpl=UtilLoggingLevel.toLevel(level);
- }
- }
+ Level levelImpl = Level.toLevel(level);
- if (levelImpl==null) {
- levelImpl=Level.toLevel(level);
- }
LocationInfo info = null;
if ((fileName != null) || (className != null) || (methodName != null) ||
(lineNumber != null)) {
info = new LocationInfo(fileName, className, methodName, lineNumber);
1.13 +0 -1
logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawConstants.java
Index: ChainsawConstants.java
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/ChainsawConstants.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ChainsawConstants.java 21 May 2004 18:45:07 -0000 1.12
+++ ChainsawConstants.java 9 Jul 2004 14:41:06 -0000 1.13
@@ -78,7 +78,6 @@
static final String EVENT_TYPE_KEY = "log4j.eventtype";
public static final String LOG4J_EVENT_TYPE = "log4j";
- public static final String UTIL_LOGGING_EVENT_TYPE = "util-logging";
static final String LEVEL_DISPLAY = "level.display";
static final String LEVEL_DISPLAY_ICONS = "icons";
1.29 +5 -0
logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html
Index: release-notes.html
===================================================================
RCS file:
/home/cvs/logging-log4j/src/java/org/apache/log4j/chainsaw/help/release-notes.html,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- release-notes.html 9 Jul 2004 05:43:47 -0000 1.28
+++ release-notes.html 9 Jul 2004 14:41:06 -0000 1.29
@@ -9,6 +9,11 @@
<h1>1.99.99</h2>
+<h2>9 July 2004</h2>
+<ul>
+ <li>XML decoders now set additional event properties (hostName, application) when
they aren't provided in the XML.</li>
+</ul>
+
<h2>8 July 2004</h2>
<ul>
<li>Corrected a bug in LogFilePatternReceiver that prevented the processing of log
files with delimited PROP entries. Thanks to Pranav Vora for reporting this.</li>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]