Java tutorial
import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.logging.LogRecord; import java.util.logging.XMLFormatter; public class Main { public static void main(String args[]) throws Exception { XMLFormatter formatter = new XMLFormatter(); LogRecord record = new LogRecord(Level.INFO, "XML message.."); FileHandler handler = new FileHandler("newxml.xml"); handler.setFormatter(formatter); handler.publish(record); handler.flush(); } }