java.util.logging
Class XMLFormatter

java.lang.Object
  extended by java.util.logging.Formatter
      extended by java.util.logging.XMLFormatter

public class XMLFormatter
extends Formatter

An XMLFormatter formats LogRecords into a standard XML format.


Constructor Summary
XMLFormatter()
          Constructs a new XMLFormatter.
 
Method Summary
 String format(LogRecord record)
          Formats a LogRecord into a string.
 String getHead(Handler h)
          Returns a string that handlers are supposed to emit before the first log record.
 String getTail(Handler h)
          Returns a string that handlers are supposed to emit after the last log record.
 
Methods inherited from class java.util.logging.Formatter
formatMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFormatter

public XMLFormatter()
Constructs a new XMLFormatter.

Method Detail

format

public String format(LogRecord record)
Description copied from class: Formatter
Formats a LogRecord into a string. Usually called by handlers which need a string for a log record, for example to append a record to a log file or to transmit a record over the network.

Specified by:
format in class Formatter
Parameters:
record - the log record for which a string form is requested.

getHead

public String getHead(Handler h)
Returns a string that handlers are supposed to emit before the first log record. The base implementation returns an empty string, but subclasses such as XMLFormatter override this method in order to provide a suitable header.

Overrides:
getHead in class Formatter
Parameters:
h - the handler which will prepend the returned string in front of the first log record. This method will inspect certain properties of the handler, for example its encoding, in order to construct the header.
Returns:
a string for the header.

getTail

public String getTail(Handler h)
Description copied from class: Formatter
Returns a string that handlers are supposed to emit after the last log record. The base implementation returns an empty string, but subclasses such as XMLFormatter override this method in order to provide a suitable tail.

Overrides:
getTail in class Formatter
Parameters:
h - the handler which will append the returned string after the last log record. This method may inspect certain properties of the handler in order to construct the tail.
Returns:
a string for the header.