Class UuidPatternConverter
java.lang.Object
org.apache.logging.log4j.core.pattern.AbstractPatternConverter
org.apache.logging.log4j.core.pattern.LogEventPatternConverter
org.apache.logging.log4j.core.pattern.UuidPatternConverter
- All Implemented Interfaces:
PatternConverter
@Plugin(name="UuidPatternConverter",
category="Converter")
public final class UuidPatternConverter
extends LogEventPatternConverter
Formats a UUID.
-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
LOGGERFields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter
CATEGORY -
Method Summary
Modifier and TypeMethodDescriptionvoidformat(LogEvent event, StringBuilder toAppendTo) Formats an event into a string buffer.static UuidPatternConverternewInstance(String[] options) Creates an instance ofUuidPatternConverter.Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
emptyVariableOutput, format, handlesThrowable, isVariableMethods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
getName, getStyleClass
-
Method Details
-
newInstance
Creates an instance ofUuidPatternConverter.The
RANDOMoption generates a Type 4 (pseudo-randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo-random number generator.The
TIMEoption 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. SeeUuidUtil.UUID_SEQUENCEhow 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 eitherRANDOMorTIME. If empty,TIMEwill be used.- Returns:
- a new
UuidPatternConverterinstance
-
format
Formats an event into a string buffer.- Specified by:
formatin classLogEventPatternConverter- Parameters:
event- event to format, may not be null.toAppendTo- string buffer to which the formatted event will be appended. May not be null.
-