public class JebuFormatter
extends java.util.logging.Formatter
| Constructor and Description |
|---|
JebuFormatter() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(java.util.logging.LogRecord record)
Format the given LogRecord.
|
java.lang.String |
getFormat() |
void |
setFormat(java.lang.String format) |
public java.lang.String format(java.util.logging.LogRecord record)
The formatting can be customized by specifying the
format string
in the
java.util.logging.SimpleFormatter.format property.
The given LogRecord will be formatted as if by calling:
String.format(format, date, source, logger, level, message, thrown);
where the arguments are:format - the java.util.Formatter format string specified in the
java.util.logging.SimpleFormatter.format property
or the default format.threadName - the current thread name.date - a Date object representing
event time of the log record.source - a string representing the caller, if available;
otherwise, the logger's name.logger - the logger's name.level - the log level.message - the formatted log message
returned from the Formatter.formatMessage(LogRecord)
method. It uses java.text
formatting and does not use the java.util.Formatter
format argument.thrown - a string representing
the throwable
associated with the log record and its backtrace
beginning with a newline character, if any;
otherwise, an empty string.Some example formats:
de.nikem.jebu.util.logging.JebuFormatter.format=[%2$tF %2$tT.%2$tL][%1s] %5$-6.6s %3$s - %6$s%n%7$s
This prints the following line
[2016-03-30 23:21:04.608][Server-Thread] INFORM org.eclipse.jetty.util.log.Log initialized - Logging initialized @226ms
This method can also be overridden in a subclass.
It is recommended to use the Formatter.formatMessage(java.util.logging.LogRecord)
convenience method to localize and format the message field.
format in class java.util.logging.Formatterrecord - the log record to be formatted.public java.lang.String getFormat()
public void setFormat(java.lang.String format)