Class LogEntryFormatter
java.lang.Object
java.util.logging.Formatter
org.apache.juneau.microservice.resources.LogEntryFormatter
Log entry formatter.
 
Uses three simple parameter for configuring log entry formats:
- 
      dateFormat - ASimpleDateFormatstring describing the format for dates.
- 
      format - A string with{...} replacement variables representing predefined fields.
- 
      useStackTraceHashes - A setting that causes duplicate stack traces to be replaced with 8-character hash strings.
This class converts the format strings into a regular expression that can be used to parse the resulting log file.
- 
Constructor SummaryConstructorsConstructorDescriptionLogEntryFormatter(String format, String dateFormat, boolean useStackTraceHashes) Create a new formatter.
- 
Method SummaryModifier and TypeMethodDescriptionReturns theDateFormatused for matching dates.Given a matcher that has matched the pattern specified bygetLogEntryPattern(), returns the field value from the match.Returns the regular expression pattern used for matching log entries.Methods inherited from class java.util.logging.FormatterformatMessage, getHead, getTail
- 
Constructor Details- 
LogEntryFormatterCreate a new formatter.- Parameters:
- format- The log entry format. e.g.- "[{date} {level}] {msg}%n" The string can contain any of the following variables:- "{date}" - The date, formatted per- "Logging/dateFormat" .
- "{class}" - The class name.
- "{method}" - The method name.
- "{logger}" - The logger name.
- "{level}" - The log level name.
- "{msg}" - The log message.
- "{threadid}" - The thread ID.
- "{exception}" - The localized exception message.
 
- dateFormat- The- SimpleDateFormatformat to use for dates. e.g.- "yyyy.MM.dd hh:mm:ss" .
- useStackTraceHashes- If- true , only print unique stack traces once and then refer to them by a simple 8 character hash identifier.
 
 
- 
- 
Method Details- 
getLogEntryPatternReturns the regular expression pattern used for matching log entries.- Returns:
- The regular expression pattern used for matching log entries.
 
- 
getDateFormatReturns theDateFormatused for matching dates.- Returns:
- The DateFormatused for matching dates.
 
- 
getFieldGiven a matcher that has matched the pattern specified bygetLogEntryPattern(), returns the field value from the match.- Parameters:
- fieldName- The field name. Possible values are:- "date" 
- "class" 
- "method" 
- "logger" 
- "level" 
- "msg" 
- "threadid" 
- "exception" 
 
- m- The matcher.
- Returns:
- The field value, or null if the specified field does not exist.
 
- 
format
 
-