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. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food.

Leave a Comment

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