[LOGBack-dev] svn commit: r565 - logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern

noreply.seb at qos.ch noreply.seb at qos.ch
Tue Sep 12 16:37:15 CEST 2006


Author: seb
Date: Tue Sep 12 16:37:14 2006
New Revision: 565

Modified:
   logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java

Log:
better output format

Modified: logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java
==============================================================================
--- logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java	(original)
+++ logback/trunk/logback-classic/src/main/java/ch/qos/logback/classic/pattern/MDCConverter.java	Tue Sep 12 16:37:14 2006
@@ -1,8 +1,8 @@
 package ch.qos.logback.classic.pattern;
 
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import ch.qos.logback.classic.spi.LoggingEvent;
 
@@ -38,13 +38,16 @@
     if (key == null) {
       // if no key is specified, return all the
       // values present in the MDC, separated with a single space.
-      StringBuffer buf = new StringBuffer();
-      Collection<String> values = mdcPropertyMap.values();
-      Iterator it = values.iterator();
-      String value;
+      StringBuffer buf = new StringBuffer("{");
+      Set<String> keys = mdcPropertyMap.keySet();
+      Iterator it = keys.iterator();
+      String tmpKey;
+      String tmpValue;
       while (it.hasNext()) {
-        value = (String)it.next();
-        buf.append(value).append(' ');
+        tmpKey = (String)it.next();
+        tmpValue = (String)mdcPropertyMap.get(tmpKey);
+        //format: {testeKey=testValue, testKey2=testValue2}
+        buf.append(tmpKey).append('=').append(tmpValue).append(", ");
       }
       return buf.toString();
     }



More information about the logback-dev mailing list