Class PatternFormatter
- java.lang.Object
-
- org.apache.logging.log4j.core.pattern.PatternFormatter
-
public class PatternFormatter extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private LogEventPatternConverterconverterstatic PatternFormatter[]EMPTY_ARRAYThe empty array.private FormattingInfofieldprivate booleanskipFormattingInfo
-
Constructor Summary
Constructors Constructor Description PatternFormatter(LogEventPatternConverter converter, FormattingInfo field)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidformat(LogEvent event, java.lang.StringBuilder buf)private voidformatWithInfo(LogEvent event, java.lang.StringBuilder buf)LogEventPatternConvertergetConverter()FormattingInfogetFormattingInfo()booleanhandlesThrowable()Normally pattern formatters are not meant to handle Exceptions although few pattern formatters might.booleanrequiresLocation()Most pattern formatters do not use location information.java.lang.StringtoString()Returns a String suitable for debugging.
-
-
-
Field Detail
-
EMPTY_ARRAY
public static final PatternFormatter[] EMPTY_ARRAY
The empty array.
-
converter
private final LogEventPatternConverter converter
-
field
private final FormattingInfo field
-
skipFormattingInfo
private final boolean skipFormattingInfo
-
-
Constructor Detail
-
PatternFormatter
public PatternFormatter(LogEventPatternConverter converter, FormattingInfo field)
-
-
Method Detail
-
format
public void format(LogEvent event, java.lang.StringBuilder buf)
-
formatWithInfo
private void formatWithInfo(LogEvent event, java.lang.StringBuilder buf)
-
getConverter
public LogEventPatternConverter getConverter()
-
getFormattingInfo
public FormattingInfo getFormattingInfo()
-
handlesThrowable
public boolean handlesThrowable()
Normally pattern formatters are not meant to handle Exceptions although few pattern formatters might.By examining the return values for this method, the containing layout will determine whether it handles throwables or not.
- Returns:
- true if this PatternConverter handles throwables
-
requiresLocation
public boolean requiresLocation()
Most pattern formatters do not use location information. When they do they should return true here so that the logging system can efficiently capture it.- Returns:
- true if location information is required.
-
toString
public java.lang.String toString()
Returns a String suitable for debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
- a String suitable for debugging.
-
-