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
LOGGER
Fields inherited from interface org.apache.logging.log4j.core.pattern.PatternConverter
CATEGORY
-
Method Summary
Modifier and TypeMethodDescriptionvoid
format
(LogEvent event, StringBuilder toAppendTo) Formats an event into a string buffer.static UuidPatternConverter
newInstance
(String[] options) Creates an instance ofUuidPatternConverter
.Methods inherited from class org.apache.logging.log4j.core.pattern.LogEventPatternConverter
emptyVariableOutput, format, handlesThrowable, isVariable
Methods inherited from class org.apache.logging.log4j.core.pattern.AbstractPatternConverter
getName, getStyleClass
-
Method Details
-
newInstance
Creates an instance ofUuidPatternConverter
.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. SeeUuidUtil.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 eitherRANDOM
orTIME
. If empty,TIME
will be used.- Returns:
- a new
UuidPatternConverter
instance
-
format
Formats an event into a string buffer.- Specified by:
format
in 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.
-