Example usage for java.util.logging FileHandler publish

List of usage examples for java.util.logging FileHandler publish

Introduction

In this page you can find the example usage for java.util.logging FileHandler publish.

Prototype

@Override
public synchronized void publish(LogRecord record) 

Source Link

Document

Format and publish a LogRecord .

Usage

From source file:Main.java

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);/*w ww.j a  v  a2 s  .c o  m*/

    handler.publish(record);
    handler.flush();
}