Class DatePatternConverter
java.lang.Object
org.apache.logging.log4j.core.pattern.AbstractPatternConverter
org.apache.logging.log4j.core.pattern.LogEventPatternConverter
org.apache.logging.log4j.core.pattern.DatePatternConverter
- All Implemented Interfaces:
ArrayPatternConverter, PatternConverter
@Plugin(name="DatePatternConverter",
category="Converter")
public final class DatePatternConverter
extends LogEventPatternConverter
implements ArrayPatternConverter
Converts and formats the event's date in a StringBuilder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static final classprivate static classprivate static final classprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicReference<DatePatternConverter.CachedTime> private final DatePatternConverter.Formatterprivate final String[]private final ThreadLocal<DatePatternConverter.Formatter> private final ThreadLocal<MutableInstant> private static final StringUNIX formatter in seconds (standard).private static final StringUNIX formatter in millisecondsFields inherited from class AbstractPatternConverter
LOGGERFields inherited from interface PatternConverter
CATEGORY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateDatePatternConverter(String[] options) Private constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate static DatePatternConverter.FormattercreateFixedFormatter(FixedDateFormat fixedDateFormat) private DatePatternConverter.FormattercreateFormatter(String[] options) private static DatePatternConverter.FormattercreateNonFixedFormatter(String[] options) voidformat(long epochMilli, StringBuilder output) voidformat(Object obj, StringBuilder output) Formats an object into a string buffer.voidformat(StringBuilder toAppendTo, Object... objects) Formats an array of Objects.voidformat(Date date, StringBuilder toAppendTo) Appends formatted date to string buffer.voidformat(LogEvent event, StringBuilder output) Formats an event into a string buffer.voidformat(Instant instant, StringBuilder output) private voidformatWithoutAllocation(Instant instant, StringBuilder output) private voidformatWithoutThreadLocals(Instant instant, StringBuilder output) private DatePatternConverter.CachedTimefromEpochMillis(long epochMillis) private MutableInstantGets the pattern string describing this date format.private DatePatternConverter.FormatterGets the timezone used by this date format.static DatePatternConverternewInstance(String[] options) Obtains an instance of pattern converter.Methods inherited from class LogEventPatternConverter
handlesThrowable, isVariableMethods inherited from class AbstractPatternConverter
getName, getStyleClassMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PatternConverter
getName, getStyleClass
-
Field Details
-
UNIX_FORMAT
-
UNIX_MILLIS_FORMAT
-
options
-
threadLocalMutableInstant
-
threadLocalFormatter
-
cachedTime
-
formatter
-
-
Constructor Details
-
DatePatternConverter
Private constructor.- Parameters:
options- options, may be null.
-
-
Method Details
-
fromEpochMillis
-
createFormatter
-
newInstance
Obtains an instance of pattern converter.- Parameters:
options- options, may be null.- Returns:
- instance of pattern converter.
-
createFixedFormatter
-
createNonFixedFormatter
-
format
Appends formatted date to string buffer.- Parameters:
date- datetoAppendTo- buffer to which formatted date is appended.
-
format
Formats an event into a string buffer.- Specified by:
formatin classLogEventPatternConverter- Parameters:
event- event to format, may not be null.output- string buffer to which the formatted event will be appended. May not be null.
-
format
-
getMutableInstant
-
format
-
formatWithoutAllocation
-
getThreadLocalFormatter
-
formatWithoutThreadLocals
-
format
Formats an object into a string buffer.- Specified by:
formatin interfacePatternConverter- Overrides:
formatin classLogEventPatternConverter- Parameters:
obj- event to format, may not be null.output- string buffer to which the formatted event will be appended. May not be null.
-
format
Description copied from interface:ArrayPatternConverterFormats an array of Objects.- Specified by:
formatin interfaceArrayPatternConverter- Parameters:
toAppendTo- The StringBuilder to add the content to.objects- The Object array.
-
getPattern
Gets the pattern string describing this date format.- Returns:
- the pattern string describing this date format.
-
getTimeZone
Gets the timezone used by this date format.- Returns:
- the timezone used by this date format.
-