Top Description Fields Constructors Methods
com.openhtmltopdf.util

public Class XRSimpleLogFormatter

extends Formatter
Class Inheritance
Imports
java.io.*, java.text.MessageFormat, java.util.ArrayList, .List, .UUID, java.util.logging.*

A java.util.logging.Formatter class that writes a bare-bones log messages, with no origin class name and no date/time.
Author
Patrick Wright

Field Summary

Modifier and TypeField and Description
private static final String
private final MessageFormat
exmformat

MessageFormat for messages with a throwable

private final MessageFormat
mformat

MessageFormat for standard messages (without Throwable)

private static final String
private final boolean[]
private final boolean[]

Constructor Summary

AccessConstructor and Description
public
public
XRSimpleLogFormatter(String msgFmt, String throwableMsgFmt)

Create a custom log formatter for use with: JDKXRLogger#JDKXRLogger(boolean, Level, Handler, Formatter) Options:

  • {0} String.valueOf(record.getMillis()),
  • {1} record.getLoggerName(),
  • {2} record.getLevel().toString(),
  • {3} record.getSourceClassName(),
  • {4} record.getSourceMethodName(),
  • {5} record.getMessage()
  • {6} record.getThrown().getName()
  • {7} record.getThrown().getMessage()
  • {8} record.getThrown() stack trace

Method Summary

Modifier and TypeMethod and Description
public String
format(LogRecord
the log record to be formatted.
record
)

Implements abstract java.util.logging.Formatter.format.

Format the given log record and return the formatted string.

public String
formatMessage(LogRecord
the log record containing the raw message
record
)

Overrides java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record.

public String
getHead(Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

public String
getTail(Handler
The target handler (can be null)
h
)

Overrides java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

private static boolean[]
usedPlaceholder(MessageFormat messageFormat)

Identify which arguments are effectively used.

Field Detail

EX_MSG_FMTback to summary
private static final String EX_MSG_FMT
exmformatback to summary
private final MessageFormat exmformat

MessageFormat for messages with a throwable

mformatback to summary
private final MessageFormat mformat

MessageFormat for standard messages (without Throwable)

MSG_FMTback to summary
private static final String MSG_FMT
usedPlaceholderForExmsgFmtback to summary
private final boolean[] usedPlaceholderForExmsgFmt
usedPlaceholderForMsgFmtback to summary
private final boolean[] usedPlaceholderForMsgFmt

Constructor Detail

XRSimpleLogFormatterback to summary
public XRSimpleLogFormatter()
XRSimpleLogFormatterback to summary
public XRSimpleLogFormatter(String msgFmt, String throwableMsgFmt)

Create a custom log formatter for use with: JDKXRLogger#JDKXRLogger(boolean, Level, Handler, Formatter) Options:

  • {0} String.valueOf(record.getMillis()),
  • {1} record.getLoggerName(),
  • {2} record.getLevel().toString(),
  • {3} record.getSourceClassName(),
  • {4} record.getSourceMethodName(),
  • {5} record.getMessage()
  • {6} record.getThrown().getName()
  • {7} record.getThrown().getMessage()
  • {8} record.getThrown() stack trace
Example (msgFmt): {1} {2}:: {5}\n

Example (throwableMsgFmt): {1} {2}:: {5} => {6}:: {7}\n

Method Detail

formatback to summary
public String format(LogRecord record)

Implements abstract java.util.logging.Formatter.format.

Format the given log record and return the formatted string.

Parameters
record:LogRecord

Doc from java.util.logging.Formatter.format.

the log record to be formatted.

Returns:String

Doc from java.util.logging.Formatter.format.

the formatted log record

Annotations
@Override
formatMessageback to summary
public String formatMessage(LogRecord record)

Overrides java.util.logging.Formatter.formatMessage.

Localize and format the message string from a log record.

Parameters
record:LogRecord

Doc from java.util.logging.Formatter.formatMessage.

the log record containing the raw message

Returns:String

Doc from java.util.logging.Formatter.formatMessage.

a localized and formatted message

Annotations
@Override
getHeadback to summary
public String getHead(Handler h)

Overrides java.util.logging.Formatter.getHead.

Return the header string for a set of formatted records.

Parameters
h:Handler

Doc from java.util.logging.Formatter.getHead.

The target handler (can be null)

Returns:String

Doc from java.util.logging.Formatter.getHead.

header string

Annotations
@Override
getTailback to summary
public String getTail(Handler h)

Overrides java.util.logging.Formatter.getTail.

Return the tail string for a set of formatted records.

Parameters
h:Handler

Doc from java.util.logging.Formatter.getTail.

The target handler (can be null)

Returns:String

Doc from java.util.logging.Formatter.getTail.

tail string

Annotations
@Override
usedPlaceholderback to summary
private static boolean[] usedPlaceholder(MessageFormat messageFormat)

Identify which arguments are effectively used.