Laconic Log Formatter
Posted by Roger Keays, 19 February 2009, 1:10 PM
/**
* Formats log messages onto one line only with only the time, level and
* message. The date is ommitted because the log files are rotated daily
* anyway.
*/
public class LaconicFormatter extends Formatter {
@Override
public String format(LogRecord record) {
return new SimpleDateFormat("HH:mm:ss ").format(
new Date(record.getMillis())) +
record.getLevel().getName().substring(0, 4) + " " +
record.getMessage() + "\n";
}
}| << Svenska Utifrån 3 | Back to Blog | Svenska Utifrån 2 >> |
Add a comment
Please visit http://www.ilikespam.com/blog/laconic-log-formatter to add your comments.