public class LogFormatter extends Formatter
2010-04-30 12:52:36:363 PDT INFO [main:1 TestLogFormatter.testPlainString] This is a test msg.The formatter catches all formatting exceptions and converts the exception to a log message dumping the exception string, format string, and arguments.
Modifier | Constructor and Description |
---|---|
|
LogFormatter()
Default constructor.
|
protected |
LogFormatter(String headerFmt,
int fmtBuffSize,
boolean isHeaderLineSep)
Constructor that does the real work.
|
Modifier and Type | Method and Description |
---|---|
String |
format(LogRecord record)
This is called by JDK logging for format the log record.
|
static String |
prepareCurlyBraceStringForLogging(String toFormat)
Format the provided string so that it can be logged without generating an
IllegalArgumentException as a result of its inherent curly braces.
|
formatMessage, getHead, getTail
public LogFormatter()
protected LogFormatter(String headerFmt, int fmtBuffSize, boolean isHeaderLineSep)
headerFmt
- header format stringfmtBuffSize
- string buffer size (multiple line formatters will want to increase this)isHeaderLineSep
- if true, a line separator will be appended after the headerpublic static String prepareCurlyBraceStringForLogging(String toFormat)
toFormat
- String to be formattedpublic String format(LogRecord record)
SimpleFormatter
which allows the sharing of the buffer.format
in class Formatter
Formatter.format(java.util.logging.LogRecord)
Copyright © 2015. All Rights Reserved.