org.pz.platypus
Class LogFormatter
java.lang.Object
java.util.logging.Formatter
org.pz.platypus.LogFormatter
public class LogFormatter
- extends java.util.logging.Formatter
Converts the default logger format to something more user friendly.
Creates a formatter for logging records. This format prints just the log message, preceded
in the case of severe or warning errors by the words "Error: " or "Warning: " respectively.
The date and time and the two-line format of the default Java console logger are thereby
removed.
- Author:
- alb
Note: adapted from The Java Developers Almanac 1.4 (adaptation example e400).
www.exampledepot.com/egs/java.util.logging/CustomFormat.html
Method Summary |
java.lang.String |
format(java.util.logging.LogRecord record)
The principal function: it accepts a LogRecord and returns the string that should
be written out by the logger. |
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 |
lits
private final Literals lits
- for Literals access
LogFormatter
public LogFormatter(Literals literals)
format
public java.lang.String format(java.util.logging.LogRecord record)
- The principal function: it accepts a LogRecord and returns the string that should
be written out by the logger. It translates the Level.Severe status into an "Error"
message and Level.Warning LogRecords into "Warning" messages.
- Specified by:
format
in class java.util.logging.Formatter
- Parameters:
record
- the LogRecord (which contains the severity and the string to log)
- Returns:
- the string to log. If null is passed in (an error), returns a newline.
Copyright © 2008-10 Pacific Data Works LLC