public class CollectorFormatter extends Formatter
The LogManager properties are:
SeverityComparator
)
CompactFormatter
)
Constructor and Description |
---|
CollectorFormatter()
Creates the formatter using the LogManager defaults.
|
CollectorFormatter(String format)
Creates the formatter using the given format.
|
CollectorFormatter(String format,
Formatter f,
Comparator<? super LogRecord> c)
Creates the formatter using the given values.
|
Modifier and Type | Method and Description |
---|---|
protected LogRecord |
apply(LogRecord t,
LogRecord u)
Used to choose the collected LogRecord.
|
protected String |
finish(String s)
Applied to the head, format, and tail returned by the target formatter.
|
String |
format(LogRecord record)
Accumulates log records which will be used to produce the final output.
|
String |
getTail(Handler h)
Formats the collected LogRecord and summary statistics.
|
String |
toString()
Formats the collected LogRecord and summary statistics.
|
formatMessage, getHead
public CollectorFormatter()
SecurityException
- if a security manager exists and the caller
does not have LoggingPermission("control").UndeclaredThrowableException
- if there are problems loading from
the LogManager.public CollectorFormatter(String format)
format
- the message format or null to use the LogManager default.SecurityException
- if a security manager exists and the caller
does not have LoggingPermission("control").UndeclaredThrowableException
- if there are problems loading from
the LogManager.public CollectorFormatter(String format, Formatter f, Comparator<? super LogRecord> c)
format
- the format string or null to use the LogManager default.f
- the formatter used on the collected log record or null to
specify no formatter.c
- the comparator used to determine which log record to format or
null to specify no comparator.SecurityException
- if a security manager exists and the caller
does not have LoggingPermission("control").UndeclaredThrowableException
- if there are problems loading from
the LogManager.public String format(LogRecord record)
getTail(java.util.logging.Handler)
method which also
resets this formatter back to its original state.format
in class Formatter
record
- the record to store.NullPointerException
- if the given record is null.public String getTail(Handler h)
java.text
argument indexes are assigned
to the following properties:
head
the
head string
returned from the target formatter and
finished by this formatter.
formatted
the current log record
formatted by
the target formatter and finished
by this formatter.
tail
the
tail string
returned from the target formatter and
finished by this formatter.
count
the total number of log records
consumed by this formatter.
remaining
the count minus one.
thrown
the total number of log records
consumed by this formatter with an assigned
throwable.
normal messages
the count minus the thrown.
minMillis
the eldest log record event time
consumed by this formatter. If no records were
formatted then this is set to the approximate start time of the JVM. By
default this parameter is defined as a number. The format type and format
style rules from the MessageFormat
should be used to
convert this to a date or time.
maxMillis
the most recent log record event time
consumed by this formatter. If no records were
formatted then this is set to the current time. By default this parameter
is defined as a number. The format type and format style rules from the
MessageFormat
should be used to convert this to a date
or time.
public String toString()
toString
in class Object
getTail(java.util.logging.Handler)
protected LogRecord apply(LogRecord t, LogRecord u)
t
- the current record.u
- the record that could replace the current.NullPointerException
- may occur if either record is null.protected String finish(String s)
s
- the string to transform.NullPointerException
- if the given string is null.Copyright © 2014 Oracle. All rights reserved.