FileDocCategorySizeDatePackage
ServerFormatter.javaAPI DocGlassfish v2 API3851Fri May 04 22:35:44 BST 2007com.sun.enterprise.server.logging

ServerFormatter

public class ServerFormatter extends SimpleFormatter
Class ServerFormatter is a formatter designed for use by the ServerHandler and designed for use by ereport (the web core native logging facility). ereport is responsible for example for outputting the message header.

Fields Summary
private MessageFormat
formatter
private static final String
lineSeparator
private static final String
fieldSeparator
Constructors Summary
Methods Summary
public synchronized java.lang.Stringformat(java.util.logging.LogRecord record)
Method format

param
record
return


              
         

        StringBuffer sb = new StringBuffer();

        // Get localized message after formatting per resource bundle if any.
        String message = formatMessage(record);

        sb.append(message);

        // Get stack trace if message was a result of exception.
        if (record.getThrown() != null) {
            try {
                StringWriter sw = new StringWriter();
                PrintWriter  pw = new PrintWriter(sw);

                record.getThrown().printStackTrace(pw);
                pw.close();
                sb.append(lineSeparator);
                sb.append(sw.toString());
            } catch (Exception ex) {}
        }
        sb.append(lineSeparator);

        return sb.toString();