Class UuidPatternConverter

All Implemented Interfaces:
PatternConverter

@Plugin(name="UuidPatternConverter", category="Converter") public final class UuidPatternConverter extends LogEventPatternConverter
Formats a UUID.
  • Method Details

    • newInstance

      public static UuidPatternConverter newInstance(String[] options)
      Creates an instance of UuidPatternConverter.

      The RANDOM option generates a Type 4 (pseudo-randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo-random number generator.

      The TIME option generates a Type 1 (date and time based) UUID using the local network interface's MAC address. To ensure uniqueness across multiple JVMs and/or class loaders on the same host, a random number between 0 and 16384 will be associated with each instance of the UUID generator class, and included in each time-based UUID generated. See UuidUtil.UUID_SEQUENCE how to seed the UUID generation with an integer value. Because time-based UUIDs contain the MAC address and timestamp, they should be used with care.

      Parameters:
      options - An array containing either RANDOM or TIME. If empty, TIME will be used.
      Returns:
      a new UuidPatternConverter instance
    • format

      public void format(LogEvent event, StringBuilder toAppendTo)
      Formats an event into a string buffer.
      Specified by:
      format in class LogEventPatternConverter
      Parameters:
      event - event to format, may not be null.
      toAppendTo - string buffer to which the formatted event will be appended. May not be null.