XMLFormatter


XMLFormatter java.util.logging

Java 1.4

This Formatter subclass converts a LogRecord to an XML-formatted string. The format( ) method returns a <record> element, which always contains <date> , <millis> , <sequence> , <level> and <message> tags, and may also contain <logger> , <class> , <method> , <thread> , <key> , <catalog> , <param> , and <exception> tags. See http://java.sun.com/dtd/logger.dtd for the DTD of the output document.

The getHead( ) and getTail( ) methods are overridden to return opening and closing <log> and </log> tags to surround all output <record> tags. Note however, that if an application terminates abnormally, the logging facility may be unable to terminate the log file with the closing <log> tag.

Figure 16-123. java.util.logging.XMLFormatter

 public class  XMLFormatter  extends java.util.logging.Formatter {  // Public Constructors  public  XMLFormatter  ( );  // Public Methods Overriding Formatter  public String  format  (LogRecord  record  );        public String  getHead  (Handler  h  );        public String  getTail  (Handler  h  );   } 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net