Just add a new line \n
to the log statement:
log.info("Message id: {}\nContents: {}", id, xml);
UPDATE: in order to print XML, see: How is it pretty to print XML with Java? . One thing to keep in mind is that there is no need to do expensive formatting unless XML is actually printed. Therefore, this is one of the rare cases when you should use is*Enabled()
:
if(log.isInfoEnabled()) log.info("Message: {}", prettyFormat(xml));
source share