Class OneLineFormatter


public class OneLineFormatter extends Formatter
Provides same information as default log format but on a single line to make it easier to grep the logs. The only exception is stacktraces which are always preceded by whitespace to make it simple to skip them.
  • Constructor Details

    • OneLineFormatter

      public OneLineFormatter()
  • Method Details

    • setTimeFormat

      public void setTimeFormat(String timeFormat)
      Specify the time format to use for time stamps in log messages.
      timeFormat - The format to use using the SimpleDateFormat syntax
    • getTimeFormat

      public String getTimeFormat()
      Obtain the format currently being used for time stamps in log messages.
      The current format in SimpleDateFormat syntax
    • format

      public String format(LogRecord record)
      Specified by:
      format in class Formatter
    • addTimestamp

      protected void addTimestamp(StringBuilder buf, long timestamp)