|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.logging.Formatter
ch.javasoft.util.logging.LogFormatter
public class LogFormatter
The LogFormatter formats log statements with the help of a
MessageFormat. The format string can be configured in the log
configuration (ch.javasoft.util.logging.LogFormatter.format property).
The following arguments are passed to the message format:
For instance, the default format produces log
statements like this:
2004-10-13 22:18:50.932 main JavaLogger INFO mymessage\n
Others might prefere the more compact plain format:
mymessage\n
| Nested Class Summary | |
|---|---|
static class |
LogFormatter.LogParameter
Constants for interplay with LogFragmenter |
| Field Summary | |
|---|---|
static MessageFormat |
FORMAT_DEFAULT
Default log format, a sample log line looks like this: |
static MessageFormat |
FORMAT_PLAIN
Plain log format, a sample log line looks like this: |
| Constructor Summary | |
|---|---|
LogFormatter()
Constructor using the default format. |
|
LogFormatter(Format format)
|
|
| Method Summary | |
|---|---|
String |
format(LogRecord record)
Formats the record as described in the class
comments. |
MessageFormat |
getDefaultFormat()
Returns the default format. |
protected MessageFormat |
getFormatFromProperties()
Read the logger format from the properties file, a log config property composed of this class's name and a '.format' suffix. |
| Methods inherited from class java.util.logging.Formatter |
|---|
formatMessage, getHead, getTail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final MessageFormat FORMAT_DEFAULT
2004-10-13 22:18:50.932 main JavaLogger INFO mymessage\nTo configure this format, set the ch.javasoft.util.logging.LogFormatter.format logging config property to
{0,date,yyyy-MM-dd} {0,time,HH:mm:ss.SSS} {1} {2} {3} | {4}{5}
public static final MessageFormat FORMAT_PLAIN
mymessage\nTo configure this format, set the ch.javasoft.util.logging.LogFormatter.format logging config property to
{4}{5}
| Constructor Detail |
|---|
public LogFormatter()
default format.
public LogFormatter(Format format)
| Method Detail |
|---|
protected MessageFormat getFormatFromProperties()
public final MessageFormat getDefaultFormat()
getFormatFromProperties()), if this is not
possible, for instance since no property exists of due to an invalid
format expression, FORMAT_DEFAULT is used instead.
public String format(LogRecord record)
class
comments.
format in class Formatter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||