The reason I did the XML configuration the way I did was because it was easy to map the Document to Nodes. I thought about using JAXB but it didn't seem like a good fit. I didn't know about Jackson at the time but I am not sure it would have been easier.
Sent from my iPhone > On May 10, 2014, at 7:45 PM, Gary Gregory <[email protected]> wrote: > > FWIW, I am redoing the JSON and XML layouts to use the same Jackson code as > for reading them back in for the listener side. In my impl, the context map > is a IO'd as a map and the context stack as an array. > > As you may have seen despite the mail outage, I've been committing in chunks > for the pieces I'll need before the new JSON/XML Jackson-based IO. Jackson is > nice for that, we get 2-for-1, which make me wonder why we do not do our > config reading using Jackson for XML. I suppose XML was impl'd before JSON > and YAML. > > Gary > > > On Sat, May 10, 2014 at 4:25 PM, <[email protected]> wrote: > > > Author: rgoers > > Date: Sat May 10 20:25:28 2014 > > New Revision: 1593727 > > > > URL: http://svn.apache.org/r1593727 > > Log: > > LOG4J2-623 - Format ThreadContext properties as a JSON map in JSONLayout > > > > Modified: > > > > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java > > > > logging/log4j/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/layout/JSONLayoutTest.java > > logging/log4j/log4j2/trunk/src/changes/changes.xml > > > > Modified: > > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java > > URL: > > http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java?rev=1593727&r1=1593726&r2=1593727&view=diff > > > > ============================================================================== > > --- > > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java > > (original) > > +++ > > logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/layout/JSONLayout.java > > Sat May 10 20:25:28 2014 > > @@ -253,34 +253,25 @@ public class JSONLayout extends Abstract > > buf.append(','); > > buf.append(this.eol); > > buf.append(this.indent2); > > - buf.append("\"Properties\":["); > > - buf.append(this.eol); > > + buf.append("\"Properties\": {"); > > final Set<Entry<String, String>> entrySet = > > event.getContextMap().entrySet(); > > int i = 1; > > for (final Map.Entry<String, String> entry : entrySet) { > > - buf.append(this.indent3); > > - buf.append('{'); > > buf.append(this.eol); > > ----- Message truncated ----- > > > > > -- > E-Mail: [email protected] | [email protected] > Java Persistence with Hibernate, Second Edition > JUnit in Action, Second Edition > Spring Batch in Action > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory
