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 LogEventPatternConverter
converter
static PatternFormatter[]
EMPTY_ARRAY
The empty array.private FormattingInfo
field
private boolean
skipFormattingInfo
-
Constructor Summary
Constructors Constructor Description PatternFormatter(LogEventPatternConverter converter, FormattingInfo field)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
format(LogEvent event, java.lang.StringBuilder buf)
private void
formatWithInfo(LogEvent event, java.lang.StringBuilder buf)
LogEventPatternConverter
getConverter()
FormattingInfo
getFormattingInfo()
boolean
handlesThrowable()
Normally pattern formatters are not meant to handle Exceptions although few pattern formatters might.boolean
requiresLocation()
Most pattern formatters do not use location information.java.lang.String
toString()
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:
toString
in classjava.lang.Object
- Returns:
- a String suitable for debugging.
-
-