http://bugzilla.slf4j.org/show_bug.cgi?id=148
--- Comment #2 from Ralph Goers <rgo...@apache.org> 2009-11-10 19:32:22 --- Thanks for looking at this 1. The data field is modified by calling getData() and then manipulating the Map. Here is some sample code: String id = "Audit"; String msg = "Transfer successful"; String type = "Transfer"; MDC.clear(); MDC.put("sessionId", "TestUser"); MDC.put("ipAddress","10.200.10.5"); MDC.put("bcId", "DI4448"); MDC.put("userId", "User1"); MDC.put("companyId", "Company1"); MDC.put("hostName", "MyHost"); MDC.put("userProduct", "Banking"); MDC.put("timezone", "America/Los_Angeles"); StructuredData data = new StructuredDataImpl(id, msg, type); Map<String, String> map = data.getData(); map.put("FromAccount", "12345601"); map.put("ToAccount", "12345602"); map.put("Amount", "55.00"); EventLogger.logEvent(data); msg = "Hello ${Name}"; type = "Welcome"; data = new StructuredDataImpl((String)null, msg, type); data.getData().put("Name", "Ralph"); Logger logger = LoggerFactory.getLogger("TestLogger"); logger.debug("", data); LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory(); context.reset(); 2. I don't understand your comment, "does not follow the contract described in StructuredData which states that non-Serializable content of the map is serialized as a String while Serializable content is simply serialized." I don't recall any definition where non-Serializable content is converted to a String simply by extending Serializable. However, since the point of the StructuredData is to provide an object to represent what is defined in RFC 5424 it would be an error for any key or value not to be a String. Since this code has to be compatible with JDK 1.3 though, it can't be specified as Map<String, String>. 3. I understand the problems in sending serialized objects across the wire. I know you feel it every time the LoggingEvent is changed. However, that is already covered by a Logback issue. 4. Having said all that, I think the serialization issue can be sidestepped by implementing readObject and writeObject. Adding a comment that the serialVersionUID shouldn't be changed and then leveraging asString(FULL) to create a String representation of the structured data and prepending a version id should be enough to provide applications that leverage serialization enough stability. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. _______________________________________________ dev mailing list dev@slf4j.org http://www.slf4j.org/mailman/listinfo/dev