Laconic Log Formatter

By , 19 February 2009

Laconic Log Formatter
/**
 * 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";
    }
}
Laconic Log Formatter

About Roger Keays

Laconic Log Formatter

I guess I'd call myself a problem solver. Either that, or I'm some sort of organic machine designed to convert oxygen into carbon dioxide. You could go either way on that. I'm into languages and stuff. I wrote a book. It's okay, I guess. What else? I like reading, swimming, eating, and playing music. Satisfied? Sheesh.

Leave a Comment

Please visit https://rogerkeays.com/laconic-log-formatter to add your comments.