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.
-
Field Summary
Fields inherited from class AbstractPatternConverter
LOGGERFields inherited from interface PatternConverter
CATEGORY -
Method Summary
Modifier and TypeMethodDescriptionvoidformat(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) Gets the pattern string describing this date format.Gets 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
-
Method Details
-
newInstance
Obtains an instance of pattern converter.- Parameters:
options- options, may be null.- Returns:
- instance of pattern converter.
-
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
-
format
-
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.
-