Thanks for the fix, Ceki. How do I request the DTD be updated to reflect the missing capabilities in LoggingEvent? I need support in the .dtd for the new properties and the MDC. Would this require a new version of 1.3 as well?
Thanks, Scott -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 18, 2003 11:58 AM To: [EMAIL PROTECTED] Subject: cvs commit: jakarta-log4j/src/java/org/apache/log4j/spi LoggingEvent.java ceki 2003/02/18 11:58:10 Modified: src/java/org/apache/log4j/spi LoggingEvent.java Log: Added a property map, similar to the one found in javax.jms.Message. The intention is to let appenders set properties and have layouts access them. Revision Changes Path 1.35 +27 -0 jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java Index: LoggingEvent.java =================================================================== RCS file: /home/cvs/jakarta-log4j/src/java/org/apache/log4j/spi/LoggingEvent.java, v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- LoggingEvent.java 21 Oct 2002 23:20:34 -0000 1.34 +++ LoggingEvent.java 18 Feb 2003 19:58:09 -0000 1.35 @@ -81,6 +81,11 @@ /** The mapped diagnostic context (MDC) of logging event. */ private Hashtable mdcCopy; + /** A map of String keys and String values. + @since 1.3 + */ + private Hashtable properties; + /** Have we tried to do an NDC lookup? If we did, there is no need * to do it again. Note that its value is always false when * serialized. Thus, a receiving SocketNode will never use it's own @@ -274,6 +279,17 @@ } } } + + /** + * Return a previously set property. The return value can be null. + * @since 1.3 + * */ + public String getProperty(String key) { + if(properties == null) + return null; + else + return (String) properties.get(key); + } public String getRenderedMessage() { if (renderedMessage == null && message != null) { @@ -367,6 +383,17 @@ // Make sure that no location info is available to Layouts if (locationInfo == null) locationInfo = new LocationInfo(null, null); + } + + /** + * Set a string property using a key and a string value. + * since 1.3 + */ + public void setProperty(String key, String value) { + if(properties == null) { + properties = new Hashtable(5); // create a small hashtable + } + properties.put(key, value); } private void writeObject(ObjectOutputStream oos) throws java.io.IOException { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]