public class LogEntryFormatter extends Formatter
Uses three simple parameter for configuring log entry formats:
SimpleDateFormat string describing the format for dates.
This class converts the format strings into a regular expression that can be used to parse the resulting log file.
| Constructor and Description |
|---|
LogEntryFormatter(String format,
String dateFormat,
boolean useStackTraceHashes)
Create a new formatter.
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(LogRecord r) |
DateFormat |
getDateFormat()
Returns the
DateFormat used for matching dates. |
String |
getField(String fieldName,
Matcher m)
Given a matcher that has matched the pattern specified by
getLogEntryPattern(), returns the field value
from the match. |
Pattern |
getLogEntryPattern()
Returns the regular expression pattern used for matching log entries.
|
formatMessage, getHead, getTailpublic LogEntryFormatter(String format, String dateFormat, boolean useStackTraceHashes)
format - The log entry format. e.g. dateFormat - The SimpleDateFormat format to use for dates. e.g. useStackTraceHashes - If public Pattern getLogEntryPattern()
public DateFormat getDateFormat()
DateFormat used for matching dates.DateFormat used for matching dates.public String getField(String fieldName, Matcher m)
getLogEntryPattern(), returns the field value
from the match.fieldName - The field name.
Possible values are:
m - The matcher.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.