Class PseudoIsoSimpleFormatter

java.lang.Object
java.util.logging.Formatter
java.util.logging.SimpleFormatter
de.aristaflow.adept2.base.registry.PseudoIsoSimpleFormatter

public class PseudoIsoSimpleFormatter extends SimpleFormatter
This formats log entries similar to SimpleFormatter except that it uses a pseudo ISO format for the timestamp instead of a datetime format using the default locale of the JVM.
  • Field Details

    • JUL_FORMAT_PROP_KEY

      protected static final String JUL_FORMAT_PROP_KEY
      jdk.internal.logger.SimpleConsoleLogger.Formatting#JUL_FORMAT_PROP_KEY
      See Also:
    • timeZone

      protected final TimeZone timeZone
      The (default) timezone used for log entry timestamps.
    • formatString

      protected final String formatString
      The format string for this SimpleFormatter.
  • Constructor Details

    • PseudoIsoSimpleFormatter

      public PseudoIsoSimpleFormatter()
  • Method Details

    • getFormat

      protected static String getFormat()
      Gets the format string to use with this SimpleFormatter. This copies the logic implemented in SimpleFormatter as close as possible. It will be slightly different since it cannot access the internal classes used by SimpleFormatter.

      First the format string is retrieved as system property using JUL_FORMAT_PROP_KEY. If this yields no format string, the LogManager is asked for the corresponding property. If this yields no format string either, the (copied) default jdk.internal.logger.SimpleConsoleLogger.Formatting#DEFAULT_FORMAT will be used except for the time where DateTimeFormatter.ISO_OFFSET_DATE_TIME will be used but printing the name of the current default timezone instead of the corresponding offset.

      Returns:
      The format string used for each log entry.
    • format

      public String format(LogRecord record)
      This uses the local time formatted as pseudo-ISO (if not re-configured) timestamp of the log entry.
      Overrides:
      format in class SimpleFormatter