Yes, logback does this well in fact. 

I can show you and example of a logback encoder that encodes to a JSON format. You can extend the concept to encode XML just the same. Possibly you could use very similar code to mine and abstract your message formatting into a builder pattern.

For my money though, I'd stick with JSON. I'd also steer you toward Logstash and Kibana as a killer combo for dealing with logs--both of these tools are free and open source.

I attached some (incomplete WRT to dependencies) code that should get the main point across.

Good Luck.


Troy