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

Roger Keays is an artist, an engineer, and a student of life. He has no fixed address and has left footprints on 40-something different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, the proper use of semicolons, and finding good food.

Leave a Comment

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